Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is Hashmap & Hashtable wirh example?

Answer Posted / venki

1. Hashtable is synchronized which means Hashtable is thread
safe and that can be shared with multiple threads (Suitable
for multi threaded applications), HashMap not synchronized
(Suitable for single threaded applications).
2. Iterator in the Hashtable is fail-fast iterator and throw
ConcurrentModificationException if any other thread modifies
the map by adding or removing elements from the Map, while
Emnumeration in HashMap not.
3. Hashtable is slower than HashMap because of synchronization.
4. HashTable does not allow null for both keys and values,
you will get NullPointerException if you add null. whereas
HashMap allows one null key and any number of null values.
5. Hashtable and HashMap allows duplicate values.
6. Hashtable store objects in insertion order but HashMap
doesn’t store objects in insertion order, to store objects
in insertion order use LinkedHashMap.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I want to persist data of objects for later use. What’s the best approach to do so?

1002


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

1148


What is meant by 'Class access modifiers'?

1093


I want to store more than 10 objects in a remote server? Which methodology will follow?

3270


What is polymorphism in java? What are the kinds of polymorphism?

1118


What are jee technologies?

1059


What do you mean by data type?

1064


How do you check if a character in a string is a digit or letter?

1123


What is binary search in java?

1040


Difference between class#getinstance() and new operator ?

1278


How to declare an arraylist in java?

1193


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

1197


What are extraneous variables examples?

1170


What is parsing and its types?

1183


What is reflexive association?

1876