Example usage for java.util.stream LongStream generate

List of usage examples for java.util.stream LongStream generate

Introduction

In this page you can find the example usage for java.util.stream LongStream generate.

Prototype

public static LongStream generate(LongSupplier s) 

Source Link

Document

Returns an infinite sequential unordered stream where each element is generated by the provided LongSupplier .

Usage

From source file:Main.java

public static void main(String[] args) {
    LongStream b = LongStream.generate(() -> {
        return 2L;
    });//from   w w w. j ava 2 s  .c o  m

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