Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Map<String, Video> videosByTitle(Course course) {
- Map<String, Video> videoMap = new HashMap(); // Create a new Map, remember to import java.util.HashMap at the top of the file
- for(Video video : course.getVideos()) { // Loop though each of the Video objects in the course's Video list
- videoMap.put(video.getTitle(), video); // Add an entry to the map where the value is the title of the Video and the key the Video
- }
- return videoMap; // Return this new Map
- }
Advertisement
Add Comment
Please, Sign In to add comment