「Java」entrySet()、keySet()でHashMapの値をソートする
方法1
Map map = new HashMap();
Iterator cft = map.entrySet().iterator();
while (cft.hasNext()) {
Map.Entry entry = (Map.Entry) cft.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
方法2
Map map = new HashMap();
Iterator cft = map.keySet().iterator();
while (cft.hasNext()) {
Object key = iter.next();
Object val = map.get(key);
}