aspose file tools
The moose likes Java in General and the fly likes Replacing HashMap with LinkedHashMap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Replacing HashMap with LinkedHashMap" Watch "Replacing HashMap with LinkedHashMap" New topic
Author

Replacing HashMap with LinkedHashMap

lubna kausar
Ranch Hand

Joined: May 06, 2006
Posts: 51
Hi,
we have an exsting system which uses Hashmap to store some objects.
Now as the order is not maintained and the size of the maps increases it leads to performance issues as after retriving the objects we need to reorder it.

We are thinking to replace HashMap with LinkedHashMap.
To be on safe side I want to know can there be any other implecations (external implecations like methid name difference or something like that).

I can not think about any such difference but need expert openion before moving further.

Thanks Ranchers
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

It should go very smoothly. They have the same API and work the same way. The only difference is the retrieval order, and since that's arbitrary in HashMap, you shouldn't be depending on it yet.

[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Replacing HashMap with LinkedHashMap
 
Similar Threads
use a *semantically* correct type if possible?
HashMap and LinkedHashMap
LinkedHashMap extends HashMap implements Map
HashMap
count instances of each word in a String