package com.logicbig.example.intstream;
import java.util.stream.IntStream;
public class RangeClosedExample {
//static IntStream rangeClosed(int startInclusive,
// int endInclusive)
public static void main(String... args) {
System.out.println("-- rangeClosed --");
IntStream intStream = IntStream.rangeClosed(1, 5);
intStream.forEach(System.out::println);
System.out.println("-- range --");
intStream = IntStream.range(1, 5);
intStream.forEach(System.out::println);
}
}
Output
-- rangeClosed --
1
2
3
4
5
-- range --
1
2
3
4