Get rid of boring for loop and try using "range" and "rangeClosed"
Most of the Java developer already started using Java 15 but here is the feature in java 8 which i want to introduce to the people who doesn't know about it or may be not using it. Lets see about two static methods "range()" and "rangeClosed()". Usage These two methods are available in IntStream and LongStream. IntStream - IntStream class is an specialization of Stream interface for int primitive. It represents an stream of primitive int-valued elements supporting sequential and parallel aggregate operations. IntStream is part of the java. util. stream package and implements AutoCloseable and BaseStream interfaces. Syntax range It returns the sequential ordered IntStream .It includes only the startInclusive value . static IntStream range( int startInclusive , int endInclusive) rangeClosed It returns the sequential ordered IntStream .It includes startInclusive and endInclusive values . static IntStream rangeCl...