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