• Post Reply Bookmark Topic Watch Topic
  • New Topic

HashMap - Hashtable  RSS feed

 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi frndz,

HashMap permits null values and null key,

HashTable doesn't allow key or value as null... why...?

Thanks in advance
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15890
82
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because that's just how those classes were designed. There's really no special reason.

You should always use HashMap and not Hashtable. Hashtable is a legacy collection class, which has more or less been replaced by HashMap since Java 1.2 (when the Collections Framework was added to Java).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!