Streams – IntStream class
IntStream.of(5); IntStream.of(1, 2, 3); IntStream.range(1, 3); IntStream.rangeClosed(1, 3); IntStream.iterate(0, i -> i + 2).limit(10); IntStream.generate(() -> (int) (Math.random() * 5)).limit(10); class Test { public static void main(String[] args) { IntStream intStream = IntStream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); intStream.forEach(item -> System.out.print(item + ” “)); } } Output: 1 2 3 4…
Read More Streams – IntStream class