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

Any Class which provides key-value pair in same order

 
pavan in
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does java has any Class which provides (get) key-value pair in same order as it was (when add).
say,
if I add ("1","A"), ("2","B"), ("3", "C").
when I get, I should get values A - B - C.
I am using jdk1.3.1 (using Weblogic 7.0 which supports only jdk1.3)
Thanks.
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not that I know of, but you can cheat by keeping a copy of the 'keys' in a separate data structure.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDK 1.4 offers the LinkedHashMap which sounds like exactly what you want. If you can't switch to 1.4 you could study the source code for LinkedHashMap to create a version for 1.3.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic