IntStream rangeClosed() in Java Last Updated : 06 Dec, 2018 Comments Improve Suggest changes Like Article Like Report IntStream rangeClosed(int startInclusive, int endInclusive) returns an IntStream from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step of 1. Syntax : static IntStream rangeClosed(int startInclusive, int endInclusive) Parameters : IntStream : A sequence of primitive int-valued elements. startInclusive : The inclusive initial value. endInclusive : The inclusive upper bound. Return Value : A sequential IntStream for the range of int elements. Example : Java // Implementation of IntStream rangeClosed // (int startInclusive, int endInclusive) import java.util.*; import java.util.stream.IntStream; class GFG { // Driver code public static void main(String[] args) { // Creating an IntStream IntStream stream = IntStream.rangeClosed(-4, 3); // Displaying the elements in range // including the lower and upper bound stream.forEach(System.out::println); } } Output: -4 -3 -2 -1 0 1 2 3 Note : IntStream rangeClosed(int startInclusive, int endInclusive) basically works like a for loop. An equivalent sequence of increasing values can be produced sequentially as : for (int i = startInclusive; i <= endInclusive ; i++) { ... ... ... } Comment More infoAdvertise with us Next Article IntStream rangeClosed() in Java S Sahil_Bansall Follow Improve Article Tags : Misc Java Java - util package Java-Functions java-stream java-intstream +2 More Practice Tags : JavaMisc Similar Reads IntStream range() in Java IntStream range(int startInclusive, int endExclusive) returns a sequential ordered IntStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1. Syntax : static IntStream range(int startInclusive, int endExclusive) Parameters : IntStream : A sequence of primitive 1 min read IntStream max() in Java with examples java.util.stream.IntStream in Java 8, deals with primitive ints. It helps to solve the problems like finding maximum value in array, finding minimum value in array, sum of all elements in array, and average of all values in array in a new way. IntStream max() returns an OptionalInt describing the ma 2 min read IntStream min() in Java with Examples java.util.stream.IntStream in Java 8, deals with primitive ints. It helps to solve the old problems like finding maximum value in array, finding minimum value in array, sum of all elements in array, and average of all values in array in a new way. IntStream min() returns an OptionalInt describing th 2 min read Infinite Loop Puzzles in Java In Java, Infinite loops are a very important concept to understand. Infinite loops can occur due to various reasons such as overflows, unboxing and logic comparisons. In this article, we will understand two common puzzles related to infinite loop.Problem 1: Infinite Loop Using Integer OverflowIn Jav 3 min read Instant range() method in Java with Examples The range() method of Instant class helps to get the range of valid values for the field passes as a parameter. This method returns ValueRange object which contains the minimum and maximum valid values for a field. This instant is helpful to enhance the accuracy of the returned range. When the field 2 min read EnumSet range() Method in Java The EnumSet.range() method is a part of the java.util package. This method is used to create an EnumSet that contains all enum constants between the specified start and end points, and it should be inclusive. It easily creates a subset of enum constants within a specified range.Syntax of EnumSet ran 2 min read Ints lastIndexOf() function | Guava | Java Guava's Ints.lastIndexOf() returns the index of the last appearance of the value target in array. Syntax: public static int lastIndexOf(int[] array, int target) Parameters: array: An array of int values, possibly empty. target: A primitive int value. Return Value: The Ints.indexOf() method returns t 2 min read Range Class | Guava | Java Guavaâs Range represents an interval, for example, a < range < b. Here range includes any value between a and b, called endpoints which form the boundary. Any value between the boundary is a contiguous span of values of type Comparable. Declaration : The declaration for com.google.common.colle 5 min read NavigableSet ceiling() method in Java The ceiling() method of NavigableSet interface in Java is used to return the least element in this set greater than or equal to the given element, or null if there is no such element. Syntax: E ceiling(E ele) Where, E is the type of elements maintained by this Set container. Parameters: This functio 2 min read Like