This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
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
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply 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: 434
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: 56543
    
  14

LinkedHashMap


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: What is a data structure for Map that preserves insert order?
 
Similar Threads
HashMap with unique key & unique values
HELP - Stuck on a TreeMap key problem
Map Issues
Retrieving insertion order of a map
Alternate way of inserting the values in map?