Check out example codes for "generate infinity steam java". It will help you in understanding the concepts better.

Code Example 1

// infinite stream of random numbers
Stream.generate(Math::random)
        .forEach(System.out::println);

Learn ReactJs, React Native from akashmittal.com