Chapter 1. Scala—a blended language
Listing 1.1. Byte conversions in scala.Predef object
Listing 1.2. Simple Java object
Listing 1.3. Implementing a first-class function in Java
Chapter 2. The core rules
Listing 2.1. Companion objects in REPL
Listing 2.2. Correct companion object in REPL
Listing 2.3. Inexpressible language features in the REPL
Listing 2.4. Java idiom: one return statement
Listing 2.5. Updated createErrorMessage with expression-oriented pattern match
Listing 2.6. Final expression-oriented createErrorMessage method
Listing 2.7. Example of imperative style code
Listing 2.8. Example mutable expression-oriented method
Listing 2.9. Mixing immutable and mutable objects with expression
Listing 2.10. Mutable objects and expressions—the right way
Listing 2.11. Mutable Point2 class
Listing 2.12. Mutable Point2 class with hashing function
Listing 2.13. Mutable Point2 class with hashing and equality
Listing 2.14. Mutating Point2 with HashMap
Listing 2.15. Simple usage of Some and None
Listing 2.16. Usage of the Option factory
Listing 2.17. Creating an object or returning a default
Listing 2.18. Executing code if option is defined
Listing 2.19. Executing code if several options are defined
Listing 2.20. Merging options
Listing 2.21. Generically converting functions
Listing 2.22. Simple InstantaneousTime class
Listing 2.23. Event subclass of InstantaneousTime
Listing 2.24. Using Event and InstantaneousTime
Listing 2.25. Using scala.Equals