Option type
- For when you don’t want to risk returning a null value
Option
s will match of its two subtypes: Some
or None
Topics to make notes on
- What is a
case
class?
- How does it differ from a regular class?
- Scala’s preferred way to represent complex data
- Immutable - depends purely on its constructor arguments
- Equality implicitly defined (objects are equal if their field values are equal)
- Can be used in pattern matching
- What is an actor?
- How can we derive an incremented val from an existing one?
- Why are tuples one-indexed?
- What’s the canonical way to create enums in Scala? Just use a Java class?
- Eager versus lazy evaluation?
- Tail recursion and its annotation?
- What is the
apply
method?
- How can it be used to make a class behave as a function?
- What is a “companion” object?
- When and why would you use it?
- Is it always used with an abstract class?
- Scala collection hierarchy with
Iterable
as the parent:
- What is an algebraic datatype (ADT)?
for
queries can be thought of as analogous to database queries