Different Kinds of Streams 4 - iterate an array map the values calculate the average

suggest change
// Java:
Arrays.stream(new int[] {1, 2, 3})
    .map(n -> 2 * n + 1)
    .average()
    .ifPresent(System.out::println); // 5.0
// Kotlin:
arrayOf(1,2,3).map { 2 * it + 1}.average().apply(::println)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents