February 2014
Beginner
1248 pages
62h 25m
English
Lines 54–58 of Fig. 17.5 create a stream pipeline that locates the odd integers in an IntStream, multiplies each odd integer by 10, sorts the values in ascending order and displays each value followed by a space.
The new feature here is the mapping operation that takes each value and multiplies it by 10. Mapping is an intermediate operation that transforms a stream’s elements to new values and produces a stream containing the resulting elements. Sometimes these are of different types from the original stream’s elements.
IntStream method map (line 56) receives an object that implements the IntUnaryOperator functional interface (package java.util.function). The lambda in line ...
Read now
Unlock full access