what is the difference between HashMap And HashTable?
Answers were Sorted based on User's Feedback
Answer / ravikiran
HashMap allows one null key and multiple null values
HashTable doesnn't allow nulls
HashMap is not synchronized
hashtable is synchronized
| Is This Answer Correct ? | 13 Yes | 0 No |
Answer / stalin
The HashMap class is roughly equivalent to Hashtable, except
that it is unsynchronized and permits nulls. (HashMap allows
null values as key and value whereas Hashtable doesnt
allow). HashMap does not guarantee that the order of the map
will remain constant over time. HashMap is unsynchronized
and Hashtable is synchronized
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / guest
HashMap is a nonsyncronized and HashTable is a
syncronized.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / venkateswarlu
HashMap :
->It is a key,value pair.
->key are not duplicated but values can be duplicated.
->Null key is possible.
->It is not Synchronized by default.
Hashtable:
->It is also key,value pair but both are Strings only.
-> Keys are not duplicated but values can be duplicated.
->Null insertion is not possible of both(key and value).
->It is Synchronized by default.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / raghu
HashMap only one null key and multiple values. Hashtable
doesn't allow null keys and values, it throws
NullPointerException. Both are not guarantee order. HashMap
is unsyncronized, whereas Hashtable is not.
| Is This Answer Correct ? | 0 Yes | 1 No |
what is function overloading in java?
0 Answers Tavant Technologies, TCS, Virtusa,
Explain the JDB in depth & command line.
how to convert mm/dd/yy to dd/mm/yy using collections in java.
How do you sort data in java?
class A{ some variables; public void a()throws Excepion1,Exception2{....} } class B extends A{ variables... public void a()throws E2,E3{.....} } Qns: here override of methods occurs or not,ore else wil give any compilation error or run properly..plz tell me briefly whts happening with the above codes....
What is map and hashmap? also tell the difference.
What is navigable map in java?
How to sort the elements in HashMap
Write a program to search a number in the given list of numbers.
Write a program to create a binary Tree ?
What are the differences between path and classpath variables?
What is singletonlist in java?