2 posts in topic
Flat View  Flat View

Posted By:   rojer_jayakumar
Posted On:   Thursday, February 1, 2007 08:20 AM

Sorry frenz...
I may ask basic doubts..
Dont mistake me ok..
Is Hash map or hash table will be the best choice in web applications..?
Will hash table allow duplicates..
can enumerator be used in hash map...

Re: Hash

Posted By:   Anonymous  
Posted On:   Wednesday, February 7, 2007 03:00 AM

I used to get the same question, whenver I thought of HashTable. The concept is actually, a little difficult to understand for beginners(and more complex for ppl with non-it background).All that stuff related to hashCode() and equals() methods. Forget this for now, as it is fairly low level concept, at this age of Java.

Read this excerpt from the JCP material:

"Like Vector, Hashtable has been in from prehistoric Java times. For
fun, don’t forget to note the naming inconsistency: HashMap vs. Hashtable. Where’s
the capitalization of “t”? Oh well, you won’t be expected to spell it. Anyway, just as
Vector is a synchronized counterpart to the sleeker, more modern ArrayList, Hashtable
is the synchronized counterpart to HashMap. Remember that you don’t synchronize a
class, so when we say that Vector and Hashtable are synchronized, we just mean that
the key methods of the class are synchronized. Another difference, though, is that
while HashMap lets you have null values as well as one null key, a Hashtable doesn’t
let you have anything that’s null."


Re: Hash

Posted By:   Amir_Pashazadeh  
Posted On:   Thursday, February 1, 2007 02:52 PM

What a silly question! What does best choice in web applications mean?

Go and check Java Collection Framework tutorials, and then realize which implementation of Map or Collection is best for your problem!!

About | Sitemap | Contact