IntStream.Builder build() example
Description
IntStream.Builder build()
builds the stream,
transitioning this builder to the built state.
Syntax
build
has the following syntax.
IntStream build()
Example
The following example shows how to use build
.
import java.util.stream.IntStream;
//from w w w . j a v a 2s.co m
public class Main {
public static void main(String[] args) {
IntStream.Builder b = IntStream.builder();
b.add(1)
.add(2)
.add(3)
.add(4);
b.build().forEach(System.out::println);
}
}
The code above generates the following result.