//temp2 is a hashmapwell if u understand the code ...( i dont see any issues here)..read on
Set set2=temp2.entrySet();
Iterator iHash2=set2.iterator();
while(iHash2.hasNext()){
Map.Entry me2= (Map.Entry) iHash2.next();
System.out.println(me2.getKey());
}
I printed the order in which the elements were entered in the HashMap and later printed the hashMap using the above algorithm... both are different.... Any idea why??
Well am replying to myself after one year...
ReplyDeleteI was a moron and did not understand HashMap which is maintained as a balanced red black tree... obviously the ordering will be lost.