
Java 11 Cookbook
By :

In addition to the Stream
interface, the java.util.stream
package also provides specialized interfaces—IntStream
, DoubleStream
, and LongStream
—that are optimized for processing streams of corresponding primitive types. They are very convenient to use, and have numeric operations, such as max()
, min()
, average()
, sum()
.
The numeric interfaces have methods similar to the methods of the Stream interface, which means that everything we have talked about in the previous recipe, Creating and operating on streams, applies to numeric streams too. That is why, in this section, we will only talk about the methods that are not present in the Stream
interface.
In addition to the methods described in the Creating and operating on streams recipe, the following methods can be used to create a numeric stream:
range(int startInclusive, int endInclusive)
and rangeClosed(int startInclusive, int endInclusive)
methods of the IntStream
and LongStream...
Change the font size
Change margin width
Change background colour