Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frequent use of HashTable class. Why?

 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On this recent thread, Joe Ess said that HashTable was the 2nd most frequently used class, after String.

Does anybody know why HashTable is used so frequently? Joe said it was used by the JVM for mapping purposes.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Does anybody know why HashTable is used so frequently? Joe said it was used by the JVM for mapping purposes.

I've noticed HashTable showing up a lot in the profiler too even though we don't have ANY references to it in our code. Joe's explanation makes sense. Newer code would mostly use HashMap rather than HashTable. But the JVM was written before HashMap was invented.
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Joe said it was used by the JVM for mapping purposes.


Really by the JVM, or do you mean the Java API classes?
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It wasn't me said it, it was Joe Ess, but yes, he said it was the JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic