• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDK1.3: Alternatives of LinkedHashMap

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I want to use the functionality of LinkedHashMap in Jdk1.3 but I don't know whether is there any Collection in JDK 1.3 which may work as LinkedHashMap.

My Usage is to use key-value pair and then if I try for retreival of Data then it should be in the same order as it was inserted originally.

Advance Thanks for Help.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just an idea

Create one valueObject with 2 fields(Key and value), pack up in ArrayList,While retrieval unpack it.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know there is no class in JDK 1.3 that does the same as what LinkedHashMap does.

However, behind the scenes, LinkedHashMap is just a HashMap together with a LinkedList. When you insert an item into it, it is inserted into the map as well as added to the list. The list is used to keep track of the order in which elements are inserted.

You could write something like LinkedHashMap yourself using this idea.

Another idea: Ofcourse it would be best to upgrade a newer version of Java, but probably you're stuck with 1.3 for some reason. Are you allowed to add third-party libraries to your project? The Apache Jakarta Commons Collections library contains a class LinkedMap that does more or less the same as LinkedHashMap.
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx Vidya & Jasper for your prompt reply, But yes this is fact, that because of some conditions I am bound with using JDK 1.3 and another thing is I cann't use any another library. But yes Jasper now I am going to design your first point.

May it helps me.

In the mean time if someone has some better idea then please do let me know.
 
reply
    Bookmark Topic Watch Topic
  • New Topic