When iterating through a HashMap with Integer keys, will it always return keys in ascending order?
问题 I have a HashMap defined as such: public Map<Integer, String> staticBlockPositions = new HashMap<Integer, String>(); I am iterating over the map by getting each key, like this: for (Integer key : blockPositions.keySet()) { System.out.println(key); } My question is, can I rely on the value of key to always be in ascending order. So if my HashMap looks something like this: { 4: "abc123", 1: "def456", 11: "qwe789", 10: "iop019" } (I know this is JSON format, this is just so you get an idea of