LongStream of(long... values) example
Description
LongStream of(long... values)
returns a sequential ordered stream whose elements are the specified values.
Syntax
of
has the following syntax.
static LongStream of(long... values)
Example
The following example shows how to use of
.
import java.util.stream.LongStream;
//from w w w . j a v a 2 s . c o m
public class Main {
public static void main(String[] args) {
LongStream b = LongStream.of(1L, 2L, Long.MAX_VALUE, Long.MIN_VALUE);
b.forEach(System.out::println);
}
}
The code above generates the following result.