sample
Stream.iterate( 5, i -> i++ )
.limit(10)
.forEach(System.out::print);
Compile → Run: Result 5555555555
sample
Stream.iterate( 0, i -> i++ )
.limit(5)
.forEach(System.out::println);
Compile → Run: Result 0 0 0 0 0
sample
Stream.iterate( 1, i -> ++i )
.limit(10)
.forEach(System.out::print);
Compile → Run: Result 12345678910
Recommended Posts