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 ConcurrentHashMap();
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?
Edit: I meant ConcurrentHashMap.