public class Code { public static void main(String[] args) { IntStreams.range(1,4) .forEach(System.out::println); // 1 2 3 Arrays.stream(new int[] {1,2,3,4}) .map(n -> n * n) .average() .ifPresent(System.out::println); // 7.5 Stream.of(1.5,2.3, 3.7) .mapToInt(Double::intValue) .forEach(System.out::println); // 1 2 3 } }