This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
In my application elements are added to a TreeMap.so whenever we are retrieving elements are displaying in the sorted order of keys.But i want to retrieve the elements in the order in which they are inserted.May i know which will be the correct choice now to do this order?
A collections class will display its elements in one order (or no particular order). They are not designed to display two different orders. If you want sorted order as well as insertion order, try your tree Map and a separate List, and add the same element to both. Or insert all your elements into the List and later pass both the key and value for every pair to the Map.