IntStream range(int startInclusive, int endExclusive)
returns
a sequential ordered IntStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1.
range
has the following syntax.
static IntStream range(int startInclusive, int endExclusive)
The following example shows how to use range
.
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream i = IntStream.range(1,7); i.forEach(System.out::println); } }
The code above generates the following result.