Useful Scala Programme

I saw a small Scala programme that allows you to calculate subtotals. The idea is that a flat file is provided with a name and a subtotal. A given namen can occur more than one, thus providing a subtotal more than once. The question is to calculate the total per name. Let me provide some records from a file that provides key data.

ABIGAIL,46
ABIGAIL,13
ABDULLAH,11

The programme then looks like:

val testTom = sc.textFile("/user/training/testTom.txt")
val filteredRows = testTom.filter(line => !line.contains("Comma")).map(line => line.split(","))
filteredRows.map ( n => (n(0),n(1).toInt)).reduceByKey((a,b) => a+b).sortBy(_._2).collect.foreach(println _)

The first line reads a file from a Hadoop platform and stores it as a so-called RDD.
The second line removes the first line and splits the other lines in elements that are split by comma.
Then, in the third line, the first column is used as a key and the data from the second column are added over the different values from the first column. The results are sorted. Finally the results are printed.
The results look like:

(JAYDEN,7807)
(MATTHEW,7891)
(MICHAEL,9187)

Door tom