Java 8 Streams Java Java API
Interface:
java.util.stream.LongStream
Method:
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 .
Examples
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); } }
Output1 2 3 4
|