Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question on Map for 1.3

 
pradeep arum
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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-
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic