File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "question on Map for 1.3" Watch "question on Map for 1.3" New topic

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 project uses currently 1.3, I can not go for 1.4


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

Joined: May 14, 2003
Posts: 799
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.


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

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:
subject: question on Map for 1.3
It's not a secret anymore!