views:

58

answers:

1

is whole Hashtable object is syncronized? I Know,Get and Put methods are synchronized. Is it mean, each entries in the Hashtable are synchronized?

If i have a hash object hsObj, and have 3 key-value pairs "a->sun" "b->tue" and "c->wed" then while getting one entry values we can put other entry values but we cant put or get at the same entry location.

Is it correct?

+3  A: 

Whole Hashtable object is syncronized. If you want more concurrent Map you might look into ConcurrentHashMap. Here is a good resource : http://www.javamex.com/tutorials/synchronization_concurrency_8_hashmap.shtml.

fastcodejava
What information i need is-> is it possible to insert an entry while retriving another entry? means i will be accessing c->wed entry, same time i will be editing a->sun. I want to know, whether each entry is synchronized ( while making changes to a->sun we cant access it)or whole hashtable is synchronized (while making changes to a->sun we can access c->wed)
sap
@sap - If you read the article, yes you can do that.
fastcodejava