You can see this example to get more idea of how you can take out the sum of all list of the collection in scala:
scala> val x = (1 to 1000) .toList
It will list down the sum of all the integer and then use the below-given code to take the sum below:
scala> x.reduce(_ + _)
You can see this example and result below:
Hope it helps!
If you want to know more about Apache Spark Scala, It's highly recommended to go for Apache Spark certification course today.