Map implementation with duplicate keys

后端 未结 18 1916
暗喜
暗喜 2020-11-22 15:23

I want to have a map with duplicate keys.

I know there are many map implementations (Eclipse shows me about 50), so I bet there must be one that allows this. I know

18条回答
  •  天涯浪人
    2020-11-22 15:47

    This problem can be solved with a list of map entry List>. We don't need to use neither external libraries nor new implementation of Map. A map entry can be created like this: Map.Entry entry = new AbstractMap.SimpleEntry("key", 1);

提交回复
热议问题