testing2/danube_test3.scala
author Christian Urban <urbanc@in.tum.de>
Tue, 29 Oct 2019 11:11:44 +0000
changeset 280 a057dc4457fc
parent 263 5a16bcb4105e
child 284 9a04eb6a2291
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
263
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
val ls_urban = List(("1", "a"), ("2", "a"), ("1", "c"), ("2", "a"), ("1", "c"))
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
val m_urban = groupById(ls_urban, Map())
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
assert(m_urban.getOrElse("1", Nil).count(_ == "c") == 2)
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
assert(m_urban.getOrElse("1", Nil).count(_ == "a") == 1)
5a16bcb4105e updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
assert(m_urban.getOrElse("2", Nil) == List("a", "a"))