- 2008 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2007 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2006 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2005 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2004 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2003 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2002 : 01 02 03 04 05 06 07 08 09 10 11 12
2003-01-26 Sun
Map の value 値取得
- public list values()
HashMap の値だけを List にして返してくる
- Reference
Java TIPS
http://cgi.tripod.co.jp/sky_lark/cgi-bin/tips/ViewTips.cgi?kind=Java
TreeSet と TreeMap
- TreeSet
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();
- TreeMap
HashMap map = new HashMap(); map.put("2", "じゃいあん"); map.put("1", "のびた"); map.put("3", "しずか"); TreeMap tm = new TreeMap(map); it = tm.values().iterator();
- 注意
デフォルトでキーでソートされるっぽい.
- Reference
Java TIPS
http://cgi.tripod.co.jp/sky_lark/cgi-bin/tips/ViewTips.cgi?kind=Java
HashMap の Key と Value を全取得
- Map.Entry を使う
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()); }
- Reference
Java TIPS
http://cgi.tripod.co.jp/sky_lark/cgi-bin/tips/ViewTips.cgi?kind=Java
- 2008 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2007 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2006 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2005 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2004 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2003 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2002 : 01 02 03 04 05 06 07 08 09 10 11 12