O'Reilly logo
live online training icon Live Online training

Scala Core Programming: Sealed Traits, Collections, and Functions

Sealed traits, collections, and functions

Daniel Hinojosa

Scala is a dynamic, general-purpose programming language for the Java Virtual Machine (JVM) used in everything from data science to distributed computing. Join expert Daniel Hinojosa for a deep dive into core Scala programming topics, focusing on collections and functions as well as Scala's Collections API. You’ll master best practices so you can write Scala code that is elegant, scalable, and fully interoperable with Java.

This class is a great follow-up if you’ve taken Daniel’s Learn the basics of Scala in 3 hours course or if you already understand concepts such as manipulating variables, classes, and functions.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • Scala's essential collections
  • The mechanics of Scala immutable collections
  • What map, flatMap, scan, and zip will do

And you’ll be able to:

  • Make informed decisions about what collection to use in a particular situation
  • Apply some of Scala's common functions to any one of these collections
  • Understand how to interpret the Collections API and how to apply a particular function

This training course is for you because...

  • You're already using Scala, and you want to know what particular collections and functions will do.
  • You want to explore Scala in more detail.


Materials or downloads needed in advance:

A machine with the latest JDK 8 or JDK 9, Scala, the latest IntelliJ or Eclipse with the Scala and Scala-IDE plugins, and SBT installed and set up

Recommended preparation:

"Why Is Scala So Popular?" (article)

Scala School Basics (tutorial)

A Scala Tutorial for Java Programmers (tutorial)

Recommended follow-up:

Scala Fundamentals (Learning Path)

Functional Programming in Scala (book)

Scala School (tutorial)

About your instructor

  • Daniel Hinojosa is an instructor, speaker, recent author, programmer, and consultant with over 20 years of experience working with private, educational, and government institutions. He is also currently a speaker on the No Fluff Just Stuff tour. Daniel loves JVM languages like Java, Groovy, and Scala, but he also dabbles with non-JVM languages like Haskell, Ruby, Python, Lisp, C, and C++. He is an avid Pomodoro Technique practitioner and attempts to learn a new programming language every year. Daniel is the author of Testing in Scala and the video Beginning Scala Programming as well as the teacher of a line of training courses, all for O’Reilly. In his downtime, he enjoys reading, swimming, playing with Legos, and cooking.


The timeframes are only estimates and may vary according to how the class is progressing

Sealing (30 minutes)

  • Lecture and hands-on exercises: Sealed abstract classes; sealed traits

Scala collections (30 minutes)

  • Lecture and hands-on exercises: The greatness of a clean API; arrays; lists; sets; maps—tuple (->) shortcut, symbols; string; stream; vector; mutable collections

Break (10 minutes)

Scala functions: Bringing everything together—part 1 (60 minutes)

  • Lecture and hands-on exercises: Creating and understanding functions; understanding closures; composing functions (compose and andThen); using functions within collections—flatMap(), forEach(), filter()

Break (10 minutes)

Scala functions: Bringing everything together—part 2 (40 minutes)

  • Lecture and hands-on exercises: groupBy(); mkString(); reduce(); collect(); scan(); zip(); view(); sorted(), sortBy()