From the course: Scala Essential Training for Data Science
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Operations on maps
From the course: Scala Essential Training for Data Science
Operations on maps
- [Instructor] Maps are Scala collections that we use to group key value pairs. Let's start with an example. We'll build a collection of country names and country capital cities, and we'll do that by specifying val, so we'll create a value, and we'll call it capitals, and capitals will be a map, and that map will include, let's start with Argentina, and that's the key. And the value is specified by using the dash greater than sign. And we'll set the value to be Buenos Aires. And that is our first key value pair. And let's also specify Canada. And the capital of Canada, of course, is Ottawa. And let's also add Egypt. This capital is Cairo, followed by Liberia, and the capital of Liberia is Monrovia. And we'll go to Netherlands whose capital is Amsterdam. And finally, let's go with the United States. The capital of the United States is Washington, DC. And we'll close that up. And we see here that the Scala repo returns capitals with a map, which is a map from string to string, which 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.
Contents
-
-
-
(Locked)
The advantages of Scala for data science2m 4s
-
(Locked)
Installing Scala1m 58s
-
(Locked)
Scala data types3m 22s
-
Working with data types in the Scala REPL5m 7s
-
(Locked)
Challenge Intro: Create variables27s
-
(Locked)
Solution: Create variables49s
-
(Locked)
Scala collections2m 24s
-
(Locked)
Operations on sets5m 32s
-
(Locked)
Operations on arrays, vectors, and ranges5m 54s
-
(Locked)
Operations on maps5m 4s
-
(Locked)
Challenge Intro: Create arrays, vectors, and ranges31s
-
(Locked)
Solution: Create arrays, vectors, and ranges53s
-
(Locked)
Scala expressions5m 13s
-
(Locked)
Challenge Intro: Create expressions28s
-
(Locked)
Solution: Create expressions33s
-
(Locked)
Scala functions3m 7s
-
(Locked)
Challenge Intro: Create functions40s
-
(Locked)
Solution: Create functions36s
-
(Locked)
Creating classes in Scala5m 48s
-
(Locked)
Creating operations in Scala3m 19s
-
(Locked)
Challenge Intro: Define a Class28s
-
(Locked)
Solution: Define a class30s
-
(Locked)
-
-
-
-
-