我想要重复值+自然顺序+空,哪个集合支持这些功能?
我已经尝试过 Multihashmap 和 TreeMultimap。Treemultimap 不允许空值,即使我有键,但它允许...
public static void main(String[] args) {
TreeMultimap<String, String> mp = TreeMultimap.create();
StringBuilder b = new StringBuilder();
mp.put("a", "10");
mp.put("a", "11");
mp.put("a", "12");
mp.put("b", "13");
mp.put("c", "14");
mp.put("e", "");
mp.put("b", "1");
mp.put("b", "2");
mp.put("b", "3");
List list = null;
for(String key : mp.keySet())
{
System.out.println("mp.values()"+mp.values());
int itemcount = mp.size();
System.out.println(itemcount);
}
预期的输出格式为
a 10 11 12
a 10 11 12
a 10 11 12
b 13 1 2 3
b 13 1 2 3
b 13 1 2 3
b 13 1 2 3
c 14
e