by shigemk2

当面は技術的なことしか書かない

MapでfoldLeftとか

特に意味はないけど。

scala> val m = List(Map("name1"->"hoge", "name2"->"fuga"), Map("name1"->"bar", "name2"->"buzz"))
m: List[scala.collection.immutable.Map[String,String]] = List(Map(name1 -> hoge, name2 -> fuga), Map(name1 -> bar, name2 -> buzz))

scala> m.foldLeft(Map[String,String]()) { (z, n) => z.updated(n("name1"), n("name2")) }
res2: scala.collection.immutable.Map[String,String] = Map(hoge -> fuga, bar -> buzz)