File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What is a data structure for Map that preserves insert order? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is a data structure for Map that preserves insert order?" Watch "What is a data structure for Map that preserves insert order?" New topic
Author

What is a data structure for Map that preserves insert order?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Java 1.6. Is there a data structure similar to Map (or implementation of Map) that will preserve the order in which I insert elements via

map.put(key1,value1)
map.put(key2,value2);
map.put(key3,value3)

? Ultimately I am looking to get back a list of Map.Entry<Object, Object> objects from the aforementioned data structure.

Thanks, - Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

LinkedHashMap


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is a data structure for Map that preserves insert order?
 
Similar Threads
Alternate way of inserting the values in map?
HashMap with unique key & unique values
Map Issues
Retrieving insertion order of a map
HELP - Stuck on a TreeMap key problem