Video is locked.

Unlock the full course today

Join today to access over 15,000 courses taught by industry experts or purchase this course individually.

Java: Generic Classes

Solution: Eliminate duplicates

From the course: Java: Generic Classes

Start my 1-month free trial
  • Course details

    Learn how to use Java generics to write cleaner and more robust code. Peggy Fisher walks through how to describe generics in Java and goes over syntax examples and type erasure. Peggy also covers the existing types of generic classes, interfaces, and methods, and shows how to create your own. Plus, at the conclusion of the course, she provides a hands-on challenge designed to help you practice and master what you learned.

    Instructor

    • Click here to view Peggy Fisher’s instructor page

      Peggy Fisher

      Content Strategist, Software Development Languages at Linkedin Learning Solutions with Lynda.com content

      Peggy Fisher is a programmer and content manager at LinkedIn Learning.

      Peggy's main focus is application programming in Java, Arduino, and C++. She has also worked on courses in COBOL and discrete ,athematics. Previously she was a faculty member at Penn State University's College of Information Sciences and Technology. She started out as a programmer working for a large insurance company, but after 18 years she left her job as a director of information technology to pursue her true passion teaching. She earned a master's degree in math education, and went on to teach high school math and computer science in Pennsylvania. In 2012, Peggy accepted a position as an instructional designer at Penn State, and shortly thereafter began teaching Intro to Application Programming with Java. She is a strong supporter of women in STEM. As one of the few female programming teachers, she serves as a mentor to incoming female freshmen who are considering a career in programming. She was also the K–12 outreach coordinator for the college, where she scheduled, ran, and taught summer camps for middle school and high school students. In a PBS NewsHour interview, she expressed that all students should take at least one programming class either in high school or college. Peggy enjoys constantly learning and finding new and exciting ways to bring technology to life in and outside of the classroom, such as using Arduino microcontrollers or Lego Mindstorms, to help make learning hands-on and fun.

    Skills covered in this course

  • Welcome

    (light music) - [Instructor] So, how did you make out with The Challenge? Were you able to create your generic method and use that to take in an array list and eliminate any duplicates? Well I hope you had success and I'd just like to walk through the process that I would use and I do want to point out, especially with this one, that everybody codes a little bit differently, so the way that I am solving this solution might be a little bit different than the way you did, but let me just show you what I did, I'm going to start with a blank NetBeans project, so I'm going to go ahead and create a new one, so I'll go File, New Project, and I want to do a Java Application, I'm going to do Next, and I'm going to call it Eliminate Duplicates, and I'll click Finish. For me, I find it easier to start with the generic method first, and then I'll go back to main, and create my array list. I'll start with one that doesn't have duplicates, and then add some duplicates, and make sure that my code is…

  • Practice while you learn with exercise files

    Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.

    Download the exercise files for this course. Get started with a free trial today.

  • Download courses and learn on the go

    Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.

    Watch this course anytime, anywhere. Get started with a free trial today.

Contents