Learning Scala

Book description

None

Table of contents

  1. Dedication
  2. Preface
    1. Who This Book Is For
    2. Why Write “Learning Scala”?
    3. Why Learn Scala (or, Why Should You Read “Learning Scala”)?
      1. Reason 1—Your Code Will Be Better
      2. Reason 2—You’ll Be a Better Engineer
      3. Reason 3—You’ll Be a Happier Engineer
    4. Why Learning Scala May Not Be for You
    5. About the Syntax Notation in This Book
    6. Conventions Used in This Book
    7. Using Code Examples
    8. Safari® Books Online
    9. How to Contact Us
    10. Acknowledgments
  3. I. Core Scala
    1. 1. Getting Started with the Scalable Language
      1. Installing Scala
      2. Using the Scala REPL
      3. Summary
      4. Exercises
    2. 2. Working with Data: Literals, Values, Variables, and Types
      1. Values
      2. Variables
      3. Naming
      4. Types
        1. Numeric Data Types
        2. Strings
          1. String interpolation
          2. Regular expressions
        3. An Overview of Scala Types
          1. Type operations
        4. Tuples
      5. Summary
      6. Exercises
    3. 3. Expressions and Conditionals
      1. Expressions
        1. Defining Values and Variables with Expressions
        2. Expression Blocks
        3. Statements
      2. If..Else Expression Blocks
        1. If Expressions
        2. If-Else Expressions
      3. Match Expressions
        1. Matching with Wildcard Patterns
        2. Matching with Pattern Guards
        3. Matching Types with Pattern Variables
      4. Loops
        1. Iterator Guards
        2. Nested Iterators
        3. Value Binding
        4. While and Do/While Loops
      5. Summary
      6. Exercises
    4. 4. Functions
      1. Procedures
      2. Functions with Empty Parentheses
      3. Function Invocation with Expression Blocks
      4. Recursive Functions
      5. Nested Functions
      6. Calling Functions with Named Parameters
      7. Parameters with Default Values
      8. Vararg Parameters
      9. Parameter Groups
      10. Type Parameters
      11. Methods and Operators
      12. Writing Readable Functions
      13. Summary
      14. Exercises
    5. 5. First-Class Functions
      1. Function Types and Values
      2. Higher-Order Functions
      3. Function Literals
      4. Placeholder Syntax
      5. Partially Applied Functions and Currying
      6. By-Name Parameters
      7. Partial Functions
      8. Invoking Higher-Order Functions with Function Literal Blocks
      9. Summary
      10. Exercises
    6. 6. Common Collections
      1. Lists, Sets, and Maps
      2. What’s in a List?
        1. The Cons Operator
      3. List Arithmetic
      4. Mapping Lists
      5. Reducing Lists
      6. Converting Collections
        1. Java and Scala Collection Compatibility
      7. Pattern Matching with Collections
      8. Summary
      9. Exercises
    7. 7. More Collections
      1. Mutable Collections
        1. Creating New Mutable Collections
        2. Creating Mutable Collections from Immutable Ones
        3. Using Collection Builders
      2. Arrays
      3. Seq and Sequences
      4. Streams
      5. Monadic Collections
        1. Option Collections
          1. Extracting values from Options
        2. Try Collections
        3. Future Collections
          1. Handling futures asynchronously
          2. Handling futures synchronously
      6. Summary
      7. Exercises
  4. II. Object-Oriented Scala
    1. 8. Classes
      1. Defining Classes
      2. More Class Types
        1. Abstract Classes
        2. Anonymous Classes
      3. More Field and Method Types
        1. Overloaded Methods
        2. Apply Methods
        3. Lazy Values
      4. Packaging
        1. Accessing Packaged Classes
        2. Packaging Syntax
      5. Privacy Controls
      6. Privacy Access Modifiers
      7. Final and Sealed Classes
      8. Summary
      9. Exercises
    2. 9. Objects, Case Classes, and Traits
      1. Objects
        1. Apply Methods and Companion Objects
        2. Command-Line Applications with Objects
      2. Case Classes
      3. Traits
        1. Self Types
        2. Instantiation with Traits
      4. Importing Instance Members
      5. Summary
      6. Break—Configuring Your First Scala Project
      7. Exercises
    3. 10. Advanced Typing
      1. Tuple and Function Value Classes
      2. Implicit Parameters
      3. Implicit Classes
      4. Types
        1. Type Aliases
        2. Abstract Types
        3. Bounded Types
        4. Type Variance
        5. Package Objects
      5. Summary
      6. Questions
    4. A. Reserved Words
  5. Index
  6. About the Author
  7. Colophon
  8. Copyright

Product information

  • Title: Learning Scala
  • Author(s):
  • Release date:
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: None