IntStream generate(IntSupplier s) returns an infinite sequential unordered stream where each element is generated by the provided IntSupplier(a supplier of int-valued results). This is suitable for generating constant streams, streams of random elements, etc.
static IntStream generate(IntSupplier s)
- IntStream : a sequence of primitive int-valued elements.
- IntSupplier : a supplier of int-valued elements.
- s : IntSupplier for generated elements.
Return Value : a new infinite sequential unordered IntStream.
Example 1 : To generate stream of random integer.
4247 6827 2676 9129 3360 8718 7925
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- IntStream forEach() method in Java
- IntStream forEachOrdered() method in Java
- IntStream.Builder add() method in Java
- IntStream.Builder accept() method in Java
- IntStream codePoints() method in Java with Examples
- java.util.stream.IntStream/LongStream | Search an element
- IntStream iterator() in Java
- IntStream rangeClosed() in Java
- IntStream map(IntUnaryOperator mapper) in Java
- IntStream findFirst() in Java
- IntStream parallel() in Java
- IntStream empty() in Java with examples
- IntStream distinct() in Java with examples
- IntStream peek() in Java with examples
- IntStream average() in Java with Examples
- IntStream max() in Java with examples
- IntStream min() in Java with Examples
- IntStream count() in Java with examples
- IntStream skip() in Java
- IntStream filter() in Java with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.