Я создал Hashmap в определенном порядке, но он итератирован по странному заказу!
Пожалуйста, рассмотрите код ниже:
HashMap map = new HashMap();
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));
}
< /code>
и результат: < /p>
Name: the name
Sort: the sort
Type: the type
ID: 1
< /code>
Мне нужно итерацию по его порядок, я положил записи. Как я могу это сделать?
Подробнее здесь: https://stackoverflow.com/questions/138 ... were-added