LinkedHashMap equivalent for JDK 1.3

Im looking for alternative implementation for LinkedHashMap so that my code will work with JDK 1.3. (LinkedHashMap was introduced in 1.4). do u guys know if there are already made code for this (before i try to roll my own). Does the Trove Collection classes have the equivalent? Thanks!
LVL 3
iboAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSoftware engineerCommented:
Can't you just copy/paste the code of LinkedHashMap?
0
iboAuthor Commented:
ive tried that. but it uses protected classes/attributes of HashMap, so i copy-pasted HashMap, then again HashMap requires another protected code from another class, which means i have to copy another class again. I think that would be my last resort if i didnt find any other alternative solution.
0
petmagdyCommented:
ok Use Vector, and for your object to be collected into this vector make sure u have implemented:

 public boolan equals(Object obj)

to be used in:

Vector.contains()
Vector.indexOf()
0
TimYatesCommented:
You can download the Jakarta Commons Collections, and they have a similar class "LinkedMap" which will work with 1.3

http://jakarta.apache.org/commons/collections/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
objectsCommented:
Or you could maintain both a list and a map, something like:

public class ListMap
{
   List list = new ArrayList();
   Map map =  new HasMap();

   void add(Object key, Object o)
   {
      map.put(key, o);
      list.add(key);
   }

   Object get(Object key)
   {
      return map.get(key);
   }

   Iterator iterator()
   {
     return list.iterator();
   }

   ..
}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.