Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.17 KB | None | 0 0
  1. case class MT(category: String, time: Long)
  2. val ml = List(MT("PM", 2),MT("PM", 1),MT("PM", 1))
  3. ml groupBy (_.category) map { case (k, v) => k -> (v map (_.time) sum) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement