Hashtable - Retrieving the two values

Lets say i have a hashtable as follows

Hashtable Dictionary =new Hashtable();

for(int code=0; code<256; code++)

{

Integer value =new Integer(code);

Integer key =new Integer(code);

Dictionary.put(key, value);

}

How can I point to an index of the hashtable and either retrieve key or value as in...

Dictionary.get(i).value or Dictionary.get(i).key

[630 byte] By [Lunny2006a] at [2007-11-27 2:36:19]
# 1
Use the result of entrySet() method.
hiwaa at 2007-7-12 2:55:30 > top of Java-index,Java Essentials,New To Java...
# 2
could you give an example
Lunny2006a at 2007-7-12 2:55:30 > top of Java-index,Java Essentials,New To Java...
# 3
ArrayList<Map.Entry> ame = new ArrayList<Map.Entry>(myHashTable.entrySet());Map.Entry<Integer,Integer> me = ame.get(index);Integer key = me.getKey();Integer value = me.getValue();
hiwaa at 2007-7-12 2:55:30 > top of Java-index,Java Essentials,New To Java...
# 4
Please note that the order of the entries in a normal HashSet (or HashMap) is unspecified and should not be depended upon. A LinkedHash(Set/Map) will maintain the insertion order (by default) of the items in it.
Herko_ter_Horsta at 2007-7-12 2:55:30 > top of Java-index,Java Essentials,New To Java...
# 5
Hashtable entries aren't indexed
georgemca at 2007-7-12 2:55:30 > top of Java-index,Java Essentials,New To Java...