LongStream.Builder add(long t)
adds an element to the stream being built.
add
has the following syntax.
default LongStream.Builder add(long t)
The following example shows how to use add
.
import java.util.stream.LongStream; /*from w w w .ja v a2 s .c o m*/ public class Main { public static void main(String[] args) { LongStream.Builder b = LongStream.builder(); b.add(1L) .add(2L) .add(3L) .add(4L); b.build().forEach(System.out::println); } }
The code above generates the following result.