In Scala lists all elements have the same type, like arrays, but unlike arrays, elements of a list cannot be changed by assignment. Since Scala stores everything as objects, the concept of declaring all elements with the same data type is quite different
- [Instructor] In addition to arrays in Scala…we can also create lists.…Lists all the elements have the same type like arrays,…but unlike arrays elements of a list…cannot be changed by assignment.…They are immutable.…Since Scala stores everything as objects…the concept of declaring all elements…with the same data type…is quite different from other languages, though.…For example, a list can have…an int, a double, and boolean…since they are all of type AnyVal.…There are two ways to create a list.…
Either you can create the list…in the similar manner you create arrays…or you can use something called the cons operator.…Let's take a look at how to create…some different types of lists.…I'm going to start by creating a simple empty list.…So I'll call it empty…and the return type is going to be of type nothing.…Now it's equal to a list with open…and closed parenthesis and nothing in between.…That's a way to create an empty list.…As I stated earlier we can create a list…that has some mix data types,…but that are still part of a higher level of data type…
- 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?
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.