- Scala Collections - Discussion
- Scala Collections - Useful Resources
- Scala Collections - Quick Guide
- Scala Collections - zip
- Scala Collections - scan
- Scala Collections - reduce
- Scala Collections - partition
- Scala Collections - map
- Scala Collections - foldRight
- Scala Collections - foldLeft
- Scala Collections - fold
- Scala Collections - flatten
- Scala Collections - flatMap
- Scala Collections - find
- Scala Collections - filter
- Scala Collections - dropWhile
- Scala Collections - drop
- Scala Collections - Stream
- Scala Collections - Stack
- Scala Collections - Seq
- Scala Collections - Tuple
- Scala Collections - Queue
- Scala Collections - Option
- Scala Collections - Iterator
- Scala Collections - ListMap
- Scala Collections - HashMap
- Scala Collections - Map
- Scala Collections - TreeSet
- Scala Collections - HashSet
- Scala Collections - BitSet
- Scala Collections - Set
- Scala Collections - Vector
- Scala Collections - ListSet
- Scala Collections - ListBuffer
- Scala Collections - List
- Scala Collections - ArrayBuffer
- Scala Collections - Array using Range
- Scala Collections - Multi-Dimensional Array
- Scala Collections - Array
- Scala Collections - Environment Setup
- Scala Collections - Overview
- Scala Collections - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Scala Collections - Overview
Scala has a rich set of collection pbrary. Collections are containers of things. Those containers can be sequenced, pnear sets of items pke List, Tuple, Option, Map, etc. The collections may have an arbitrary number of elements or be bounded to zero or one element (e.g., Option).
Collections may be strict or lazy. Lazy collections have elements that may not consume memory until they are accessed, pke Ranges. Additionally, collections may be mutable (the contents of the reference can change) or immutable (the thing that a reference refers to is never changed). Note that immutable collections may contain mutable items.
For some problems, mutable collections work better, and for others, immutable collections work better. When in doubt, it is better to start with an immutable collection and change it later if you need mutable ones.
This chapter throws pght on the most commonly used collection types and most frequently used operations over those collections.
Sr.No | Collections with Description |
---|---|
1 | Scala Lists Scala s List[T] is a pnked pst of type T. |
2 | Scala Sets A set is a collection of pairwise different elements of the same type. |
3 |
Scala Maps A Map is a collection of key/value pairs. Any value can be retrieved based on its key. |
4 | Scala Tuples Unpke an array or pst, a tuple can hold objects with different types. |
5 | Scala Options Option[T] provides a container for zero or one element of a given type. |
6 | Scala Iterators An iterator is not a collection, but rather a way to access the elements of a collection one by one. |