I have application which runs on both 1.4 and 1.6. Order of elements is getting printed in 1.6 version is different than 1.4. I used LinkedHashMap which fixed the problem. Now this order is exactly same as of 1.4. I didn’t find 1.4 source code of HashMap except downloading entire jdk . Except generic whats been changed in newer versions?
I have application which runs on both 1.4 and 1.6 . Order of elements
Share
The iteration order of elements in
HashMapwas never guaranteed, so implementations were free to change it. This shortcoming has been remedied byLinkedHashMap.Such a change might be caused by e.g. the complete revamping of the hashing algorithm in Java 1.4.1… but then again, we also noticed such a change upon migrating our project to Java6 so there was a change in that version too.