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