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