public static Stream < Integer > range ( final int from , final int to , final int step ) { return new Stream < Integer > ( ) { @ Override public Iterator < Integer > iterator ( ) { return new ReadOnlyIterator < Integer > ( ) { int value = from ; @ Override public boolean hasNext ( ) { return value < to ; } @ Override public Integer next ( ) { final int v = value ; value += step ; return v ; } } ; } } ; }
Creates a stream that contains a given number of integers starting from a given number .