| Author |
Any Class which provides key-value pair in same order
|
pavan in
Ranch Hand
Joined: Oct 22, 2002
Posts: 64
|
|
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
Joined: Mar 16, 2001
Posts: 965
|
|
|
Not that I know of, but you can cheat by keeping a copy of the 'keys' in a separate data structure.
|
Please ignore post, I have no idea what I am talking about.
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
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.
|
"I'm not back." - Bill Harding, Twister
|
 |
 |
|
|
subject: Any Class which provides key-value pair in same order
|
|
|