Acknowledgments |
Introduction |
Programming Styles in Scala |
Scala and Other Languages |
Who Is This Book For? |
What’s in This Book? |
Scala Version Used in This Book |
Online Resources |
1. | Exploring Scala |
Scala Features |
More with Less |
Functional Programming |
2. | Taking Scala for a Ride |
Using the REPL |
Scala on the Command Line |
Running Scala Code as a Stand-alone Script |
Compiling Scala |
3. | From Java to Scala |
Scala as Concise Java |
Scala Classes for Java Primitives |
Tuples and Multiple Assignments |
Flexible Parameters and Arguments |
Implicit Parameters |
Strings and Multiline Raw Strings |
String Interpolation |
Sensible Defaults |
Operator Overloading |
Scala Surprises for the Java Eyes |
Default Access Modifier |
4. | Working with Objects |
Creating and Using Classes |
Following the JavaBean Convention |
Type Aliasing |
Extending a Class |
Parameterized Types |
Singletons and Companions |
Creating Enumerations |
Package Objects |
5. | Making Use of Types |
Type Inference |
Fundamental Types |
Return Type Inference |
Variance of Parameterized Type |
Implicit Type Conversions |
Value Classes |
Using Implicit Conversions |
6. | Function Values and Closures |
Limitations of Normal Functions |
Extensibility with Higher-Order Functions |
Function Values with Multiple Parameters |
Currying |
Positional Notation for Parameters |
Parameter Routing |
Reusing Function Values |
Partially Applied Functions |
Closures |
Execute Around Method Pattern |
7. | Traits |
Understanding Traits |
Selective Mixins |
Decorating with Traits |
Method Late Binding in Traits |
8. | Collections |
Common Scala Collections |
Using a Set |
Associative Maps |
Immutable Lists |
Method Name Convention |
The for Expression |
9. | Pattern Matching and Regular Expressions |
Comprehensive Matching |
Pattern Variables and Constants in case Expressions |
Matching Using case Classes |
Extractors and Regular Expressions |
The Omnipresent Underscore Character |
10. | Handling Exceptions |
Exceptions in Scala |
Mind the Catch Order |
11. | Programming Recursions |
A Simple Recursion |
Tail Call Optimization (TCO) |
Trampoline Calls |
12. | Lazy Evaluations and Parallel Collections |
Let’s Get Lazy |
Making Strict Collections Lazy |
The Ultimately Lazy Streams |
Parallel Collections |
13. | Programming with Actors |
A Sequential Time-Consuming Problem |
The Treacherous Paths to Concurrency |
Creating Actors |
Actors and Threads |
Isolated Mutability |
Concurrency with Actors |
Usage Recommendations |
14. | Intermixing with Java |
Using Scala Classes from Scala |
Using Java Classes from Scala |
Using Scala Methods from Java |
Using Traits from Java |
Using Singletons and Companion Objects from Java |
Extending Classes |
15. | Creating an Application with Scala |
Getting Users’ Input |
Reading and Writing Files |
XML as a First-Class Citizen |
Reading and Writing XML |
Getting Stock Prices from the Web |
Making the Net Asset Application Concurrent |
16. | Unit Testing |
Using JUnit |
Using ScalaTest |
Using Mockito |
A1. | Installing Scala |
Downloading |
Installing |
A2. | Web Resources |
Bibliography |
3.145.8.42