خرید بک لینک

Vote count: 0

I read about hashMap and how it is different from hashtable. Like in hashtable the complete object gets locked while in case of concurrent hashmap only a part of it is locked. My question is what happens when two threads try to access the same value correspoding to a key at the samme time.

Lets say

 Map mp = new HashMap(); 
 mp.put(1, "Hello");

Thread 1: trying to read mp.get(1).

Thread 2: trying to write/modify into it mp.put(1, "Hi").

so What value does thread 1 gets to read?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 16 فروردين 1395 ساعت: 5:17

صفحه بندی