Linked Questions
11 questions linked to/from ConcurrentHashMap and Hashtable in Java
654
votes
19
answers
350k
views
What's the difference between ConcurrentHashMap and Collections.synchronizedMap(Map)?
I have a Map which is to be modified by several threads concurrently.
There seem to be three different synchronized Map implementations in the Java API:
Hashtable
Collections.synchronizedMap(Map)
...
-1
votes
1
answer
931
views
Difference between Hashtable and ConcurrentHashMap [duplicate]
Can someone elaborate this line briefly?
“In Summary ConcurrentHashMap only locked certain portion of Map while
Hashtable lock full map while doing iteration”
4346
votes
35
answers
1.8m
views
What are the differences between a HashMap and a Hashtable in Java?
What are the differences between a HashMap and a Hashtable in Java?
Which is more efficient for non-threaded applications?
19
votes
3
answers
26k
views
ConcurrentHashMap locking
I have read somewhere that in ConcurrentHashMap, the whole map object is not locked and instead a lock is made on a portion of the Map.
Can somebody elaborate when does locking come into the picture?...
3
votes
3
answers
5k
views
locking mechanism used in concurrentHashMap and hashtable
This question was recently asked to me in java interview.
I tried to search it later but couldn't find the exact answer.
In case if any1 have a link o the answer please let me know.
So here goes my ...
1
vote
2
answers
2k
views
Is it safe to replace all the occurrences of Hashtable with ConcurrentHashmap?
Our legacy multi-threaded application has a lots of usage of Hashtable. Is it safe to replace the Hashtable instances with ConcurrentHashmap instances for performance gain? Will there be any side ...
0
votes
2
answers
2k
views
Java- How to create Java Hashtable from HashMap
I want to Create Java Hashtable from HashMap.
HashMap hMap = new HashMap();
//populate HashMap
hMap.put("1","One");
hMap.put("2","Two");
hMap.put("3","Three");
//create new Hashtable
...
0
votes
2
answers
3k
views
Java collection framework which does not allow null and allows parallel access
Hashtable does not allow any null as key or value, and Hashtable is legacy and only single thread can access at a time.
Which collection class doesn't allow any null and allows concurrent access?
...
0
votes
3
answers
722
views
Java and thread safety when creating a cache from scratch
Is the following code thread safe?
private static HashMap<String, String> cache = null;
public static String getInfo(String key) {
populateCache();
return cache.containsKey(key) ? ...
1
vote
1
answer
228
views
Read and write into shared thread variables
first of all i am new to threads and shared variables. So please be kind with me ;-)
I'm having a class called Routing. This class recieves and handles messages. If a message is of type A the ...
0
votes
2
answers
54
views
java synchronize collections selection for application requirement
What is synchronized collection means in java . Which to choose for developing application if i am printing records of user in jsp page from servlet?which to choose among the following
...