This is my hashmap :
HashMap hashMapTest = new HashMap();
and I insert Date.getTime()
into this
The strange thing is when i call the hashmap with, the order is completly an other and the keys doesnt fit to the insertion :
HashMap does NOT maintain the order of insertion but there is an alternative called LinkedHashMap that maintains the insertion order. Or if you want the keys to be sorted in natural order(using keys compareTo method) then you may go for TreeMap.