aspose file tools*
The moose likes Java in General and the fly likes question on Map for 1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "question on Map for 1.3" Watch "question on Map for 1.3" New topic
Author

question on Map for 1.3

pradeep arum
Ranch Hand

Joined: Oct 01, 2003
Posts: 130
Hi all,
my question is, like LinkedHashMap for jdk1.4 which preserves the insertion order, is there any class in jdk1.3?, if there is not!!! what is the best way to simulate an insertion order preserving Map with key-value pairs.my project uses currently 1.3, I can not go for 1.4

thanks
pradeep


SCJP1.4,SCBCD
Failure is not when you fall down; its only when you fail to get up again.
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Create a class that encapsulates a map and an ordered list (ArrayList). Stores the keys in the list object and ensure that it stays synchronized with the map.

-Jeff-


Books: Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It looks like Jakarta Commons Collections already has a couple classes that do this. I expect they should work in 1.3, as they don't seem to use 1.4-specific code. Check out ListOrderedMap and LinkedMap.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question on Map for 1.3