Runnable r = () -> System.out.println(“Run, Lambda!”);
Use the built-in interfaces included in the java.util.function package such as Predicate, Consumer, Function, and Supplier
Develop code that uses primitive versions of functional interfaces
Develop code that uses binary versions of functional interfaces
Develop code that uses the UnaryOperator interface
BaseStream<T,S extends BaseStream<T,S>>
How to Create Stream?
The class StreamSupport has a number of low-level methods for creating a stream, all using some form of a Spliterator (Spliterators.spliteratorUnknownSize(java.util.Iterator, int). A late-binding Spliterator binds to the source of elements at the point of first traversal, first split, or first query for estimated size, rather than at the time the Spliterator is created. A Spliterator that is not late-binding binds to the source of elements at the point of construction or first invocation of any method.)
Create stream from iterator (spliterator)
Stream<String> targetStream = StreamSupport.stream(
Iterable<String> iterable = () -> sourceIterator;
Stream<String> targetStream = StreamSupport.stream(iterable.spliterator(), false);
Collection via the stream() and parallelStream() methods
Stream.builder().add(...).add(...) ... .build()
What is intermediate operations?
mapToInt, mapToDouble, mapToLong
flatMap, flatMapToInt, flatMapToDouble, flatMapToLong
What is terminal operations?