A map is a collection of key/value pairs. Any value can be retrieved based on its key. This video covers the creation of maps in addition to the logic required to traverse a map.
- [Lecturer] In Scala, the Map collection type…allows us to store key-value pairs.…Using this concept of storing key-value pairs…allows us to retrieve any value based on its key.…In your Exercise Files folder, under Chapter 03, 03_06,…you'll find a file called mapExamples.sc.…This is a worksheet that I created…that has an example of a Map.…So on line two I declared a variable called groceries…and it's equal to a Map, notice the capital M…and then in parentheses it has a list of key-value pairs.…
So this is a grocery list that has four items,…milk, bread, juice and eggs.…All right, let's take a look at what we can do with Maps.…If we want to we can add additional items to our Map,…so we can type groceries, we can say that's equal to…groceries plus, and we have to give it a key-value pair.…Now, because I have one, two, three, four,…the next logical key would be five,…but it doesn't have to be sequential,…I could've put in a key-value of six…and this value is going to be hashbrowns.…
Looks like we have some breakfast items…
Join Peggy Fisher as she helps get you started with Scala, so you can leverage the unique capabilities it offers. First, learn the basics of type inference, variables, loops, functions, and operators. Then, find out how to read files using a console, perform pattern matching, handle exceptions, and more. Finally, learn how to use classes, fields, methods, and objects.
- Integrating with IDEs
- Scala worksheets
- Scala repl sessions
- Type inference
- Creating variables
- Working with loops
- Higher-order functions
- Scala operators
- Working with decision statements
- Handling exceptions using try or catch
- Working with tuples and arrays
- Classes, fields, and methods
Skill Level Intermediate
Java Platforms Compared: SE vs EE vs MEwith Peggy Fisher25m 38s Intermediate
Scala Essential Training for Data Sciencewith Dan Sullivan1h 51m Intermediate
1. Getting Started with 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.