reduceByKey takes two parameters, applies a function, and returns
reduceByKey (_ + _) ByKey ((x, y) = > x + y)
:
val numbers = Array(1, 2, 3, 4, 5)
val sum = numbers.reduceLeft[Int](_+_)
println("The sum of the numbers one through five is " + sum)
:
The sum of the numbers one through five is 15
numbers: Array[Int] = Array(1, 2, 3, 4, 5)
sum: Int = 15
ByKey (_ ++ _) ByKey ((x, y) = > x ++ y)