To solidify your understanding of the Map function, rewrite it from scratch, first using a "for" loop, then using the Collect function—a fairly straightforward exercise that is nevertheless very helpful for understanding Map on a deeper level.
(uplifting upbeat music) … - [Instructor] Now that we've had a lot of practice … with Java Stream-related functions, … in order to make sure … that you really understand these functions, … let's do a few simple challenges. … As you can see, in this file that I've given you, … there are three classes. … One is a person class, one is a color class, … and one is an employee class. … Furthermore, down in the main method here, … there is a few lists that I've created for you … that contain some basic data using these classes. … So what you're going to do is with each list, … I've given you a challenge. … For the first one here where we have … a list of people objects, your task is, … given this list, return a list that contains only … the people's names, so this is going to be a list … of only strings, okay? … Your next challenge is given a list of cars, … use the functions that we've talked … about so far in this section to return … a list that contains only the blue cars in this list. … And last but not least, given the list of employees here, …
Skill Level Advanced
Java Design Patterns: Structuralwith Bethan Palmer1h 38m Intermediate
1. Introduction to Functional Programming
2. First-Class Functions
3. Working with Streams in Java
4. Advanced Concepts
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.