Java Reference
In-Depth Information
You've now seen a lot of stream operations that you can use to express sophisticated data
processing queries! Table 5.1 summarizes the operations seen so far. You get to practice them in
the next section through an exercise.
Table 5.1. Intermediate and terminal operations
Operation Type
Return
type
Type/functional
interface used
Function
descriptor
filter
Intermediate
Stream<T>
Predicate<T>
T -> boolean
distinct
Intermediate
Stream<T>
(stateful-unbounded)
skip
Intermediate
Stream<T>
long
(stateful-bounded)
limit
Intermediate
Stream<T>
long
(stateful-bounded)
map
Intermediate
Stream<R>
Function<T, R>
T -> R
flatMap
Intermediate
Stream<R>
Function<T, Stream<R>>
T -> Stream<R>
sorted
Intermediate
Stream<T>
Comparator<T>
(T, T) -> int
(stateful-unbounded)
anyMatch
Terminal
boolean
Predicate<T>
T -> boolean
noneMatch
Terminal
boolean
Predicate<T>
T -> boolean
allMatch
Terminal
boolean
Predicate<T>
T -> boolean
findAny
Terminal
Optional<T>
findFirst
Terminal
Optional<T>
Search WWH ::




Custom Search