- Scala Collections - Home
- Scala Collections - Overview
- Scala Collections - Environment Setup
- Scala Collections - Arrays
- Scala Collections - Array
- Scala Collections - Multi-Dimensional Array
- Scala Collections - Array using Range
- Scala Collections - ArrayBuffer
- Scala Collections - Lists
- Scala Collections - List
- Scala Collections - ListBuffer
- Scala Collections - ListSet
- Scala Collections - Vector
- Scala Collections - Sets
- Scala Collections - Set
- Scala Collections - BitSet
- Scala Collections - HashSet
- Scala Collections - TreeSet
- Scala Collections - Maps
- Scala Collections - Map
- Scala Collections - HashMap
- Scala Collections - ListMap
- Scala Collections - Miscellaneous
- Scala Collections - Iterator
- Scala Collections - Option
- Scala Collections - Queue
- Scala Collections - Tuple
- Scala Collections - Seq
- Scala Collections - Stack
- Scala Collections - Stream
- Scala Collections Combinator methods
- Scala Collections - drop
- Scala Collections - dropWhile
- Scala Collections - filter
- Scala Collections - find
- Scala Collections - flatMap
- Scala Collections - flatten
- Scala Collections - fold
- Scala Collections - foldLeft
- Scala Collections - foldRight
- Scala Collections - map
- Scala Collections - partition
- Scala Collections - reduce
- Scala Collections - scan
- Scala Collections - zip
- Scala Collections Useful Resources
- Scala Collections - Quick Guide
- Scala Collections - Useful Resources
- Scala Collections - Discussion
Scala Collections Tutorial
Scala has a rich set of collection library. Scala Collections may be strict or lazy. Lazy collections have elements that may not consume memory until they are accessed, like 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.
This Scala Collections Tutorial is based on the Latest Scala 3.8.3 version.
Scala Hello World Program
The very first program in Scala is to print "Hello, World!" on the screen. The following is the Scala code that will print "Hello, World!" on the screen. You can edit and run this code by clicking on the "Edit & Run" button.
object HelloWorld {
def main(args: Array[String]) = {
println("Hello, world")
}
}
Online Scala Compiler
Our Scala tutorial contains various examples in each chapter to explain the different concepts. We have provided an online compiler where you can write, save, run, and share your programs directly from your browser without setting up any development environment. Practice Scala here: Online Scala Compiler.
Audience
This tutorial has been prepared for the beginners to help them understand Scala Collections library to use Collections in Scala based programs.
Prerequisites
For this tutorial, we assume the readers to have prior knowledge of basic software development using Java or Scala. It will help if you had some exposure to the software build and deployment process.