LongStream builder()
returns a builder for a LongStream.
builder
has the following syntax.
static LongStream.Builder builder()
The following example shows how to use builder
.
import java.util.stream.LongStream; /*from www . ja v a 2 s. co m*/ public class Main { public static void main(String[] args) { LongStream.Builder b = LongStream.builder(); b.accept(2L); b.accept(2L); b.accept(2L); LongStream s = b.build(); s.forEach(System.out::println); } }
The code above generates the following result.