LongStream of(long t) example

Description

LongStream of(long t) returns a sequential LongStream containing a single element.

Syntax

of has the following syntax.


static LongStream of(long t)

Example

The following example shows how to use of.


import java.util.stream.LongStream;
/* www  .ja v a 2s.com*/
public class Main {
  public static void main(String[] args) {
    LongStream b = LongStream.of(1L);

    b.forEach(System.out::println);
  }
}

The code above generates the following result.





















Home »
  Java Streams »
    Reference »




Collectors
DoubleStream
DoubleStream.Builder
IntStream
IntStream.Builder
LongStream
LongStream.Builder
Stream
Stream.Builder