Numeric stream interfaces
As we have mentioned already, all three numeric interfaces, IntStream
, LongStream
, and DoubleStream
, have methods similar to the methods in the Stream
interface, including the methods of the Stream.Builder
interface. This means that everything we have discussed so far in this chapter equally applies to any numeric stream interfaces. That is why, in this section, we will only talk about those methods that are not present in the Stream
interface, as follows:
- The
range(lower,upper)
andrangeClosed(lower,upper)
methods in theIntStream
andLongStream
interfaces allow you to create a stream from the values in the specified range. - The
boxed()
andmapToObj()
intermediate operations convert a numeric stream toStream
- The
mapToInt()
,mapToLong()
, andmapToDouble()
intermediate operations convert a numeric stream of one type to a numeric stream of another type. - The
flatMapToInt()
,flatMapToLong()
, andflatMapToDouble()
intermediate operations convert...