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