List of usage examples for java.util.stream IntStream limit
IntStream limit(long maxSize);
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.iterate(1, n -> n + 1); i.limit(10).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 4); i.limit(3).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { int[] numbers = { 2, 3, 5, 7, 11, 13 }; IntStream intStream = Arrays.stream(numbers); intStream = intStream.limit(3); System.out.println(intStream.sum()); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.generate(() -> { return (int) (Math.random() * 100); });// w w w . ja v a2 s . c om i.limit(10).forEach(System.out::println); }