def foo(a: Map[String, Int], b: HashMap[String, Int]) {
// okay
val ab = a |+| b
// value |+| is not a member of scala.collection.immutable.HashMap[String,Int]
val ba = b |+| a
}
为什么 HashMaps 不是 Semigroups,但 Maps 是?来自面向对象的背景,我原以为 HashMap 与 Map 一样强大?