Programming in ScalaProgramming in Scala is the definitive book on Scala, the new language for the Java Platform that blends object-oriented and functional programming concepts into a unique and powerful tool for developers. Coauthored by the designer of the Scala language, this authoritative book will teach you, one step at a time, the Scala language and the ideas behind it. The book is carefully crafted to help you learn. The first few chapters will give you enough of the basics that you can already start using Scala for simple tasks. The entire book is organized so that each new concept builds on concepts that came before - a series of steps that promises to help you master the Scala language and the important ideas about programming that Scala embodies. A comprehensive tutorial and reference for Scala, this book covers the entire language and important libraries. |
Contents
A Scalable Language | 3 |
First Steps in Scala | 23 |
Next Steps in Scala | 37 |
Classes and Objects | 59 |
Basic Types and Operations | 73 |
Functional Objects | 95 |
Builtin Control Structures | 115 |
Functions and Closures | 139 |
Implicit Conversions and Parameters | 437 |
Implementing Lists | 459 |
For Expressions Revisited | 473 |
Extractors | 489 |
Annotations | 505 |
Working with XML | 513 |
Modular Programming Using Objects | 527 |
Object Equality | 543 |
Control Abstraction | 161 |
Composition and Inheritance | 177 |
Scalas Hierarchy | 205 |
Traits | 213 |
Packages and Imports | 233 |
Assertions and Unit Testing | 249 |
Case Classes and Pattern Matching | 263 |
Working with Lists | 297 |
Collections | 329 |
Stateful Objects | 357 |
Type Parameterization | 381 |
Abstract Members | 407 |
Common terms and phrases
abstract class actor annotations AnyRef apply argument array Array[String ArrayElement BinOp Boolean cell chapter ChecksumAccumulator constructor contains create curly braces Currency database defined definition denom elem elements equals method error evaluated example expr extends extractor factory method false field filter flatMap function literal functional programming hashCode Here’s immutable immutable objects implementation implicit conversions import inheritance initialized input instance integer invoked Iterator Java Java platform java.lang.String Java’s JSON JUnit language List[Int List[T loop modules multiple mutable operand operator override def toString package parentheses parsed parser passed pattern match queue Rational recursive regular expression result type returns Scala code Scala compiler Scala program Section sequence setter shown in Listing simple simulation singleton object spreadsheet static type String subclass subtype superclass syntax tail recursive takes trait tuple type inference type parameter variable width Wire write yield