Jul 11, 2024
forEach
and its usage.forEach
nums.stream()
or nums.parallelStream()
.Mapping Values: Example - Doubling Values
map
method: data.map(n -> n * 2)
ForEach
Handling Streams
filter(n -> n % 2 == 1)
for odd numbers.reduce(0, (acc, elem) -> acc + elem)
Predicate
functional interface (filter(Predicate)
)Function
functional interface (map(Function)
)stream().filter(...).map(...).forEach(...)