public list values()
HashMap の値だけを List にして返してくるReference
Java TIPShttp://cgi.tripod.co.jp/sky_lark/cgi-bin/tips/ViewTips.cgi?kind=Java
List list = new ArrayList();
list.add(new Integer(3));
list.add(new Integer(2));
list.add(new Integer(1));
TreeSet ts = new TreeSet(list);
Iterator it = ts.iterator();
HashMap map = new HashMap();
map.put("2", "じゃいあん");
map.put("1", "のびた");
map.put("3", "しずか");
TreeMap tm = new TreeMap(map);
it = tm.values().iterator();
HashMap map = new HashMap();
map.put("key1", "value1");
map.put("key2", "value2");
map.put("key3", "value3");
map.put("key4", "value4");
map.put("key5", "value5");
TreeMap treeMap = new TreeMap(map);
Set set = treeMap.entrySet();
Iterator it = set.iterator();
while(it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}