Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this Book
About the Authors
About the Cover Illustration
1. Fundamentals
Chapter 1. Java 8: why should you care?
1.1. Why is Java still changing?
1.1.1. Java’s place in the programming language ecosystem
1.1.2. Stream processing
1.1.3. Passing code to methods with behavior parameterization
1.1.4. Parallelism and shared mutable data
1.1.5. Java needs to evolve
1.2. Functions in Java
1.2.1. Methods and lambdas as first-class citizens
1.2.2. Passing code: an example
1.2.3. From passing methods to lambdas
1.3. Streams
1.3.1. Multithreading is difficult
1.4. Default methods
1.5. Other good ideas from functional programming
1.6. Summary
Chapter 2. Passing code with behavior parameterization
2.1. Coping with changing requirements
2.1.1. First attempt: filtering green apples
2.1.2. Second attempt: parameterizing the color
2.1.3. Third attempt: filtering with every attribute you can think of
2.2. Behavior parameterization
2.2.1. Fourth attempt: filtering by abstract criteria
2.3. Tackling verbosity
2.3.1. Anonymous classes
2.3.2. Fifth attempt: using an anonymous class
2.3.3. Sixth attempt: using a lambda expression
2.3.4. Seventh attempt: abstracting over List type
2.4. Real-world examples
2.4.1. Sorting with a Comparator
2.4.2. Executing a block of code with Runnable
2.4.3. GUI event handling
2.5. Summary
Chapter 3. Lambda expressions
3.1. Lambdas in a nutshell
3.2. Where and how to use lambdas