我有一张地图清单:
val input = List( Map("id" -> "abc", "val" -> 100),
Map("id" -> "abc", "val" -> 109),
Map("id" -> "bca", "val" -> 115),
Map("id" -> "acb", "val" -> 100),
Map("id" -> "cba", "val" -> 105),
Map("id" -> "cba", "val" -> 110),
Map("id" -> "cba", "val" -> 116) )
我需要从中过滤出所有共享key" id"的共同值的地图。换句话说,我只需保留密钥id值唯一的映射。
val output = List( Map("id" -> "bca", "val" -> 115),
Map("id" -> "acb", "val" -> 100) )
答案 0 :(得分:8)
使用分组
*item
*{sp}item