RE: what is the difference between hash map and has...
Hashmap is not synchronised and allows null for key and values where as Hashtable is synchronised and does not allow null values. The elements may not be in an order in the case of hashmap.
RE: what is the difference between hash map and has...
Both provide key-value access to data. The Hashtable is one of the original collection classes in Java. HashMap is part of the new Collections Framework added with Java 2 v1.2.
The key difference between the two is that access to the Hashtable is synchronized on the table while access to the HashMap isn't. You can add it but it isn't there by default.
Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. If you change the map while iterating you'll know.
And a third difference is that HashMap permits null values in it while Hashtable doesn't. (From jGuru)
RE: what is the difference between hash map and has...
Hasmap is not syncronized and hash table is synchronized Hashmap allows num values in the key value pair where as hashtable doesn't allow null value pairs.
RE: what is the difference between hash map and hash table?
Both provide key-value access to data. The Hashtable is one of the original collection classes in Java. HashMap is part of the new Collections Framework added with Java 2 v1.2.
The key difference between the two is that access to the Hashtable is synchronized on the table while access to the HashMap isn't. You can add it but it isn't there by default.
Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. If you change the map while iterating you'll know.
And a third difference is that HashMap permits null values in it while Hashtable doesn't.
RE: what is the difference between hash map and hash table?
**hashmap and hashtable are both collection framework data structures ** both datastructres stores data in the form of key values **in hashtable key must be String and value must be an object hashtable ht new hashtable(); ht.put("button" value(new Button("ok")); / / key(String) value(object) **in hashmap key value willbe Strings hashmap hp new hashmap(); String var "india";
hp.put("great" var); / / key value (String) (String)