map

Map <String, ArrayList> map = new HashMap <String, ArrayList>();
Set<String> keys = map.keySet();
Iterator<String> iterator = keys.iterator();
while(iterator.hasNext()) {
    String key = iterator.next();
    ArrayList arrayList = map.get(key);
    for(Object o : arrayList) {
        ...
    }
}

Map<String, List<String>> map = new HashMap <String, List<String>>();
map.put(...);

for(Map.Entry<String, List<String>> entry : map.entrySet()) {
    String key = entry.getKey();   
    List<String> values = entry.getValue();
    for(String value : values) {
       System.out.println(key + " --> " + value);
    }
}

你可能感兴趣的:(map)