Map That Retains Order-of-Insertion
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
public class Main {
public static void main(String[] argv) throws Exception {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("1", "value1");
map.put("2", "value2");
map.put("3", "value3");
map.put("2", "value4");
for (Iterator it = map.keySet().iterator(); it.hasNext();) {
Object key = it.next();
Object value = map.get(key);
}
}
}