I've set a HashMap on certain order but it is iterated on a strange order!
Please consider code below:
HashMap<String, String> map = new HashMap<String, String>();
map.put("ID", "1");
map.put("Name", "the name");
map.put("Sort", "the sort");
map.put("Type", "the type");
...
for (String key : map.keySet()) {
System.out.println(key + ": " + map.get(key));
}
and the result:
Name: the name
Sort: the sort
Type: the type
ID: 1
I need to iterate it in order i've put the entries. Any help will be appreciated.