A Practical Guide for Java 8 Lambdas and Streams
Last updated on 2019-12-23
About the Book
This book is not the first book about Java 8 lambda expressions and streams, and it's definitely not the last book about lambda expressions and streams. Java 8 is a Java platform upgrade which the community looking forward to for a long time. Lambda expressions and streams quickly gain popularity in Java developers. There are already a lot of books and online tutorials about lambda expressions and streams. This book is trying to explain lambda expressions and streams from a different perspective.
- For lambda expressions, this book explains in details based on JSR 335.
- For streams, this book covers fundamental concepts of Java core library.
- This book provides how-to examples for lambda expressions and streams.
- This book also covers the important utility class Optional.
Lambda expressions and streams are easy to understand and use. This book tries to provide some insights about how to use them efficiently.
- 1. Introduction
2. Lambda expressions
- 2.1 Start a thread - A simple example
- 2.2 Functional interfaces
- 2.3 Target typing
- 2.4 Lambda expressions
- 2.5 Lexical scoping
- 2.6 Effectively final local variables
2.7 Method references
- 2.7.1 Types of method references
2.8 Default interface methods
- 2.8.1 Static interface methods
3. Functional interfaces
BiFunctionwith predefined types
Consumerwith predefined types
3.2.4 Example of using
Supplierwith predefined types
BiPredicatewith predefined types
- 3.5.3 Operators with predefined types
- 3.1 Functions
- 4.1 User-specified behavior
4.2 Basic stream concepts
- 4.2.1 Sequential or parallel
- 4.2.2 Encounter order
4.3 Stream operation characteristics
- 4.3.1 Stateful or stateless
Spliterators for primitive types
- 4.5.4 Late-binding and fail-fast
4.9 Stream sources
- 4.9.1 Arrays
- 4.9.2 Collections
- 4.9.3 Stream builder
4.9.4 I/O channels
- 18.104.22.168 lines
- 22.214.171.124 list
- 126.96.36.199 walk
- 188.8.131.52 find
- 4.10 Examples for stream processing
4.11 Stream intermediate operations
- 4.11.9 Operations chaining
4.12 Stream terminal operations
- 4.12.4 match
- 4.12.5 find
- 184.108.40.206 Collect into collections
- 220.127.116.11 averaging
- 18.104.22.168 summing
- 22.214.171.124 summarizing
4.12.9 Parallel stream
- 126.96.36.199 Parallel reduction
4.13.1 How to convert a
- 4.13.2 How to filter map entries by keys?
- 4.13.3 How to filter map entries by values?
- 4.13.4 How to group elements by multiple conditions?
- 4.13.5 How to combine multiple collections into a stream?
- 4.13.6 How to convert a stream to another stream with different type?
- 4.13.7 How to find an element in the stream?
- 4.13.8 How to sort map entries?
- 4.13.9 Exceptions handling in streams
- 4.13.1 How to convert a
5.2 Usage of
- 5.2.1 Simple usage
- 5.2.2 Chained usage
- 5.2.3 Functional usage
5.3.1 How to interact with legacy library code before
5.3.2 How to get value from chained
5.3.3 How to get first value of a list of
5.3.4 How to chain method invocations with return value of
Optionalobjects in sequence?
5.3.5 How to convert an
Optionalobject to a stream?
5.3.6 How to use
Optionalto check for
nulland assign default values?
- 5.3.1 How to interact with legacy library code before
- 5.1 What’s
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.