Java IntStream create from iterate()
and limit()
method
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream s = IntStream.iterate(1, n -> n + 1) .limit(10);/* ww w.ja va 2s . co m*/ s.forEach(System.out::println); } }