From the course: Scala Essential Training for Data Science
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Scala objects - Scala Tutorial
From the course: Scala Essential Training for Data Science
Scala objects
- [Instructor] Now we're going to discuss Scala classes and objects. I'm going to start the Scala REPL. Classes are definitions of structures and operations on those structures. Recall that Scala is an object oriented language and variables are all objects. When we create a variable or value of a particular data type we can access the operations that are defined on that type. For example, when we create an array we get access to a method, which can sort the elements of the array. Let's create a value, we'll call it y, and we'll say that it's an Array. And let's give it some names of countries, like England, Liberia, Haiti, Australia, and Sweden. Now the Array, of course, will order the elements according to how we entered them, but I can say y and call the sorted method on the Array y and it will return a sorted version, in this case alphabetical order version, because it's strings. Now we get this because the sort method is defined for Arrays. Now often when working with data sets it…
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
-
-
-
The advantages of Scala for data science1m 34s
-
(Locked)
Installing Scala2m 56s
-
(Locked)
Scala data types4m 34s
-
(Locked)
Scala collections1m 17s
-
(Locked)
Scala sets Scala arrays, vectors, and ranges5m 37s
-
(Locked)
Scala maps4m 28s
-
(Locked)
Scala expressions3m 40s
-
(Locked)
Scala functions2m 46s
-
(Locked)
Scala objects8m 5s
-
-
-
-
-
-