Java 8 Streams Java Java API
java.util.stream.LongStream
static LongStream range(long startInclusive, long endExclusive)
This method returns a sequential ordered IntStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1.
IntStream
startInclusive
endExclusive
1
package com.logicbig.example.longstream;import java.util.stream.LongStream;public class RangeExample { public static void main(String... args) { LongStream longStream = LongStream.range(1, 5); longStream.forEach(System.out::println); }}
1234