Why Scala?
What About Java ?
Using SBT
Running the Scala REPL in IDEs
A Taste of Concurrency
Semicolons
Ranges
Method Declarations
Methods with Multiple Argument Lists
Nesting Method Definitions and Recursion
Reserved Words
Integer Literals
Boolean Literals
String Literals
Function Literals
Option, Some, and None: Avoiding nulls
Organizing Code in Files and Namespaces
Imports Are Relative
Abstract Types Versus Parameterized Types
Operator Overloading?
Methods with Empty Argument Lists
Domain-Specific Languages
Scala for Comprehensions
Generator Expressions
Yielding
Other Looping Constructs
Scala do-while Loops
Using try, catch, and finally Clauses
lazy val
Interpolated Strings
Recap and What’s Next
A Simple Match
Matching on Sequences
Guards in case Clauses
unapply Method
Matching on Variable Argument Lists
More on Binding Variables in case Clauses
Sealed Hierarchies and Exhaustive Matches
Concluding Remarks on Pattern Matching
Implicit Arguments
Scenarios for Implicit Arguments
Capabilities
Implicit Evidence
Improving Error Messages
Rules for Implicit Arguments
Build Your Own String Interpolator
Type Class Pattern
Implicit Resolution Rules
Wise Use of Implicits
What Is Functional Programming?
Variables That Aren’t
Anonymous Functions, Lambdas, and Closures
Recursion
Trampoline for Tail Calls
Currying and Other Transformations on Functions
Sequences
Sets
Traversal
Flat Mapping
Folding and Reducing
Tail Recursion Versus Traversals of Infinite Collections
What About Making Copies?
Recap: The Elements of for Comprehensions
Translation Rules of for Comprehensions
Option as a Container
Try: When There Is No Do
Recap and What’s Next
Class and Object Basics
Value Classes
Constructors in Scala
The Uniform Access Principle
Validating Input
Good Object-Oriented Design: A Digression
Recap and What’s Next
Interfaces in Java
Stackable Traits
Class or Trait?
Parameterized Types: Variance Under Inheritance
Variance of Mutable Types
The Scala Type Hierarchy
Products, Case Classes, and Tuples
Implicit Conversions
Condition Checking Methods
Miscellaneous Methods
The equals Method
The eq and ne Methods
Recap and What’s Next
Overriding Members of Classes and Traits
Attempting to Override final Declarations
Overriding Abstract and Concrete Fields
When Accessor Methods and Fields Are Indistinguishable: The Uniform
Linearization of an Object’s Hierarchy
Generic, Mutable, Immutable, Concurrent, and Parallel Collections, Oh My!
The collectionconcurrent Package
The collectiongeneric Package
The scalacollectionmutable Package
Choosing a Collection
Builder
Like Traits
Miniboxing
Public Visibility: The Default
Public Visibility
Private Visibility
Final Thoughts on Visibility
Parameterized Types
Type Constructors
Type Bounds
Lower Type Bounds
View Bounds
Comparing Abstract Types and Parameterized Types
Structural Types
Type Refinements
Recap and What’s Next
Path-Dependent Types
Csuper
Dependent Method Types
Singleton Types
Tuple Types
Infix Types
Type Lambdas
Recap and What’s Next
Algebraic Data Types
Properties of Algebraic Data Types
Category Theory
The Functor Category
The Importance of Monad
The scalasysprocess Package
Async
Akka: Actors for Scala
Pickling and Spores
Recap and What’s Next
Big Data: A Brief History
Moving Beyond MapReduce
A List of Scala-Based Data Tools
A Motivating Example: ActiveRecord in Ruby on Rails
DSL Considerations
Examples: XML and JSON DSLs for Scala
External DSLs with Parser Combinators
A Payroll External DSL
Recap and What’s Next
Command-Line Tools
The scala Command-Line Tool
The scaladoc Command-Line Tool
Build Tools
Other Build Tools
Text Editors
Third-Party Libraries
Using Java Names in Scala Code
JavaBean Properties
Scala Names in Java Code
Recap of What We Already Know
Traits as Modules
Creational Patterns
Behavioral Patterns
The Parthenon Architecture
Tools for Understanding Types
Reflecting on Types
Scala’s Advanced Runtime Reflection API
A Macro Example: Enforcing Invariants
Wrapping Up and Looking Ahead