Streams overview
How lambdas compile, how stream pipelines execute lazily, collectors like groupingBy and toMap, Optional guidelines, and when parallel streams hurt, with senior-level pitfalls.
Lambda expressions
A lambda is a short piece of code you can pass around, written `(input) -> result`.
Functional interfaces
A functional interface has exactly one abstract method, so a lambda can stand in for it.
Method references
A method reference is a shorter lambda that just calls an existing method, written `Class::method`.
map, filter and collect
A stream is a pipeline for data.
Grouping and collectors
Collectors turn a stream into a result.
flatMap
`flatMap` turns each item into a stream and joins all of those streams into one.
reduce
`reduce` combines all items of a stream into a single value by applying an operation again and again, such as adding numbers.
Parallel streams
A parallel stream splits the work across several CPU cores.
Optional
`Optional` is a box that holds a value or is empty.
Default and static interface methods
Since Java 8 an interface can contain methods with a body.
Date and Time API
The `java.time` package (Java 8) replaced the old `Date` and `Calendar`.