Class 25 - Scala Fundamentals - Manipulating Collections

Class 25 - Scala Fundamentals - Manipulating Collections
0.0 0

#1

Originally published at: https://kaizen.itversity.com/topic/class-25-scala-fundamentals-manipulating-collections/


#2

So i think this is one way to solve the excercise.
def getRevenueForEachOrder(orderItems: List[String]) = {
orderItems.
groupBy(k => k.split(",")(1).toInt).
map(k => (k._1,k._2.map(e => e.split(",")(4).toFloat).sum)).
toList
}