Difference between Hash Table and Hash Map?
Answers were Sorted based on User's Feedback
Answer / ranganathkini
Hashtable and HashMap are more less similar to each other
except that the HashMap is unsynchronized and allows nulls
whereas Hashtable is synchronized and does not permit nulls.
| Is This Answer Correct ? | 27 Yes | 2 No |
Answer / arun kumar rout
hashtable is Synchronised where as hashmap is not.
| Is This Answer Correct ? | 17 Yes | 2 No |
Answer / ravikiran
HashTable is the collection which is legacy.Which doenn't
allows null keys and null values.And methods access is
synchronized.
HashMap is the collection which can allow one null key and
multiple null values.And methods access is not synchronized.
| Is This Answer Correct ? | 12 Yes | 2 No |
Answer / guest
Hash Table is synchronized but Hash Map is not. Means Hash
Map allow Null value for key and value but Hash Table does
not allow.
| Is This Answer Correct ? | 7 Yes | 5 No |
Answer / guest
HashTable is synchronized where as HashMap is not.
HashMap allows null values for (key,value) for only once
where as HashTable does not.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / hemasankar reddy suggu
1)Hashtable method all are synchronized where as HashMap
does not Synchornized all methods
2)HAshtable object is thread safe where HashMap object is
not thread Safe
3)Hashtable perfomance is low where Hashtable performance is
High
4)null is not allowed in Hashtable but HAshMap null is allowed
5)Hashtable is Interduced in 1.0V where HashMap interduced
in 1.2V
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / anand
HashTable is the collection which is legacy.Which doenn't
allows null keys and null values.And methods access is
synchronized.
HashMap is the collection which can allow one null key and
multiple null values.And methods access is not synchronized.
| Is This Answer Correct ? | 2 Yes | 5 No |
Answer / devendra.m
HashMap and HashTable both are equal...
HashMap is non-synchronized one,where as HashTable
synchronized one.
HashMap allows null as a key & value pair.
where as hashtable wont allows null as key & value pair.
| Is This Answer Correct ? | 1 Yes | 6 No |
Answer / santosh nayak
HashMap hm=new HashMap();
hm.put("s","s");
hm.put("a","a");
hm.put(null,"r");
hm.put(null,"t");
hm.put("e","e");
This is the code where we can allow multiple null key values
in HashMap.
| Is This Answer Correct ? | 1 Yes | 12 No |
What is class variable java?
Does a class inherit the constructors of its superclass in java programming?
Can this keyword be used to refer static members?
Is there any way to find whether software installed in the system is registered by just providing the .exe file? I have tried the following code but its just displaying the directory structure in the registry. Here the code : package com.msi.intaller; import java.util.Iterator; import ca.beq.util.win32.registry.RegistryKey; import ca.beq.util.win32.registry.RootKey; public class RegistryFinder { public static void main(String... args) throws Exception { RegistryKey.initialize(RegistryFinder.class.getResource("jRe gistryKey.dll").getFile()); RegistryKey key = new RegistryKey(RootKey.HKLM, "Software\\ODBC"); for (Iterator<RegistryKey> subkeys = key.subkeys(); subkeys.hasNext();) { RegistryKey subkey = subkeys.next(); System.out.println(subkey.getName()); // You need to check here if there's anything which matches "Mozilla FireFox". } } }
What are different types of Exceptions?.
Is there any difference between synchronized methods and synchronized statements?
Which is bigger float or double?
when,where and how to use abstract class and interface
What is args length in java?
Can we start a thread twice in java?
What is a numeric literal?
what is Vector class?