Java 8 Lambdas

Book description

None

Table of contents

  1. Preface
    1. Why Should I Read This Book?
    2. Who Should Read This Book?
    3. How to Read This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  2. 1. Introduction
    1. Why Did They Need to Change Java Again?
    2. What Is Functional Programming?
    3. Example Domain
  3. 2. Lambda Expressions
    1. Your First Lambda Expression
    2. How to Spot a Lambda in a Haystack
    3. Using Values
    4. Functional Interfaces
    5. Type Inference
    6. Key Points
    7. Exercises
  4. 3. Streams
    1. From External Iteration to Internal Iteration
    2. What’s Actually Going On
    3. Common Stream Operations
      1. collect(toList())
      2. map
      3. filter
      4. flatMap
      5. max and min
      6. A Common Pattern Appears
      7. reduce
      8. Putting Operations Together
    4. Refactoring Legacy Code
    5. Multiple Stream Calls
    6. Higher-Order Functions
    7. Good Use of Lambda Expressions
    8. Key Points
    9. Exercises
    10. Advanced Exercises
  5. 4. Libraries
    1. Using Lambda Expressions in Code
    2. Primitives
    3. Overload Resolution
    4. @FunctionalInterface
    5. Binary Interface Compatibility
    6. Default Methods
      1. Default Methods and Subclassing
    7. Multiple Inheritance
      1. The Three Rules
    8. Tradeoffs
    9. Static Methods on Interfaces
    10. Optional
    11. Key Points
    12. Exercises
    13. Open Exercises
  6. 5. Advanced Collections and Collectors
    1. Method References
    2. Element Ordering
    3. Enter the Collector
      1. Into Other Collections
      2. To Values
      3. Partitioning the Data
      4. Grouping the Data
      5. Strings
      6. Composing Collectors
      7. Refactoring and Custom Collectors
      8. Reduction as a Collector
    4. Collection Niceties
    5. Key Points
    6. Exercises
  7. 6. Data Parallelism
    1. Parallelism Versus Concurrency
    2. Why Is Parallelism Important?
    3. Parallel Stream Operations
    4. Simulations
    5. Caveats
    6. Performance
    7. Parallel Array Operations
    8. Key Points
    9. Exercises
  8. 7. Testing, Debugging, and Refactoring
    1. Lambda Refactoring Candidates
      1. In, Out, In, Out, Shake It All About
      2. The Lonely Override
      3. Behavioral Write Everything Twice
    2. Unit Testing Lambda Expressions
    3. Using Lambda Expressions in Test Doubles
    4. Lazy Evaluation Versus Debugging
    5. Logging and Printing
    6. The Solution: peek
    7. Midstream Breakpoints
    8. Key Points
  9. 8. Design and Architectural Principles
    1. Lambda-Enabled Design Patterns
      1. Command Pattern
      2. Strategy Pattern
      3. Observer Pattern
      4. Template Method Pattern
    2. Lambda-Enabled Domain-Specific Languages
      1. A DSL in Java
      2. How We Got There
      3. Evaluation
    3. Lambda-Enabled SOLID Principles
      1. The Single Responsibility Principle
      2. The Open/Closed Principle
      3. The Dependency Inversion Principle
    4. Further Reading
    5. Key Points
  10. 9. Lambda-Enabled Concurrency
    1. Why Use Nonblocking I/O?
    2. Callbacks
    3. Message Passing Architectures
    4. The Pyramid of Doom
    5. Futures
    6. Completable Futures
    7. Reactive Programming
    8. When and Where
    9. Key Points
    10. Exercises
  11. 10. Moving Forward
  12. Index
  13. Colophon
  14. Copyright

Product information

  • Title: Java 8 Lambdas
  • Author(s):
  • Release date:
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: None