commons Collections4 MultiMap

Posted 学习、实践、总结

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了commons Collections4 MultiMap相关的知识,希望对你有一定的参考价值。

MultiMap<String, Integer> multiMap = new MultiValueMap<>();
multiMap.put("A", 1);
multiMap.put("A", 2);
multiMap.put("A", 3);
Collection col = (Collection) multiMap.get("A");
for (Object obj : col) {
    System.out.println(obj);
}

  这是一个多值Map的工具类。这个map的值都是collection类型。(如果同一个key只put了一次,那么还get到的还是Collection类型)

以上是关于commons Collections4 MultiMap的主要内容,如果未能解决你的问题,请参考以下文章