Use LinkedHashMap to retain
Map map = new LinkedHashMap();
// Add some elements
map.put("a", new Integer(1));
map.put("b", new Integer(2));
map.put("c", new Integer(3));
// List the entries
for (Iterator it=map.keySet().iterator(); it.hasNext(); ) {
Object key = it.next();
Object value = map.get(key);
}
// [a=1, b=2, c=3]
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment