如何拆分值?
public static void main(String[] args) {
// Map<String,Set<String>> dep = new HashMap<String,Set<String>>();
MultiHashMap mp = new MultiHashMap();
mp.put("a", "10");
mp.put("a", "12");
mp.put("a", "11");
mp.put("b", "1");
mp.put("c", "14");
mp.put("e", "");
mp.put("b", "1");
mp.put("b", "2");
mp.put("b", "3");
List list = null;
Set set = mp.entrySet();
Iterator i = set.iterator();
while (i.hasNext()) {
Map.Entry me = (Map.Entry) i.next();
list = (List) mp.get(me.getKey());
int itemCount = list.size();
for (int z = 0; z < itemCount; z++) {
System.out.println(me.getKey());
System.out.println(me.getValue());
}
}
}
但我得到的价值是
e
[]
b
[1, 1, 2, 3]
b
[1, 1, 2, 3]
b
[1, 1, 2, 3]
b
[1, 1, 2, 3]
c
[14]
a
[10, 12, 11]
a
[10, 12, 11]
a
[10, 12, 11]
但我需要将值显示为
a:10
a:12
a:11
b:1
b:1
b:2
b:3
c:14
e:
如何像上面那样打印值?