Method iterate() of Stream object in Java

In Java 8, the iterate() method has been introduced and it has only two parameters and will help us to create an infinite stream. Content:

Example: