Scala – Traits
In this guide, we will discuss Scala Traits. A trait encapsulates method and field definitions, which can then be reused by mixing them into classes. Unlike class inheritance, in which…
In this guide, we will discuss Scala Traits. A trait encapsulates method and field definitions, which can then be reused by mixing them into classes. Unlike class inheritance, in which…
In this guide, we will discuss Scala Iterators. An iterator is not a collection, but rather a way to access the elements of a collection one by one. The two…
Scala Options [ T ] is a container for zero or one element of a given type. An Option[T] can be either Some[T] or None object, which represents a missing value. For instance, the…
Scala tuple combines a fixed number of items together so that they can be passed around as a whole. Unlike an array or list, a tuple can hold objects with…
Scala maps is a collection of key/value pairs. Any value can be retrieved based on its key. Keys are unique in the Map, but values need not be unique. Maps…
Scala Sets is a collection of pairwise different elements of the same type. In other words, a Set is a collection that contains no duplicate elements. There are two kinds…
Scala Lists are quite similar to arrays which means, all the elements of a list have the same type but there are two important differences. First, lists are immutable, which…
In this guide, we will discuss Scala Collections. Scala has a rich set of collection library. Collections are containers of things. Those containers can be sequenced, linear sets of items…
In this guide, we will discuss Scala Arrays. Scala provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used…
This chapter takes you through the Scala Strings. In Scala, as in Java, a string is an immutable object, that is, an object that cannot be modified. On the other…