Create a list of movies and use the Map class to map the movie with the corresponding rating. Then use the movie as a key to get the rating, add another movie, and use the foreach loop to print the contents of our mapped variables. Understand how to use t
- [Narrator] For this challenge…we're going to write some Scala code.…This time we're going to actually use the map class.…We're going to create a map of movies and their ratings.…I'm sure most of you are already familiar…with creating arrays, so I thought the map class…would be a good one to tackle.…Once we create our map,…next we'll use one of the movies…as key to get the rating,…then we'll print out all the values in our list.…Finally we'll add a new movie to the list…and then reprint the list.…
Here's some sample movies that you can use…or you can just make up your own.…Finding Nemo rated G,…Finding Dory rated PG,…Men in Black rated PG-13,…The Avengers rated PG-13,…and then add Harry Potter and the Sorcerer's Stone rated PG.…I estimate that this challenge…will take about ten minutes.…When you're done come back and take a look…at my solution video and you'll see the thought process…that I used to create this program.…
- Installing Scala
- Integrating with IDEs
- Creating variables
- Using special functions
- Basic types and operations
- Tuples, sets, maps, arrays, and lists
- Classes, fields, and methods
- Singleton objects
Skill Level Intermediate
1. Why Scala?
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- 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.