InterviewSolution
| 1. |
What is ConcurrentHashMap and Hashtable? In java, why is ConcurrentHashMap considered faster than Hashtable? |
|
Answer» ConcurrentHashMap: It was introduced in Java 1.5 to store data using multiple buckets. As the name SUGGESTS, it allows CONCURRENT READ and writes operations to the map. It only locks a certain portion of the map while doing iteration to provide thread safety so that other readers can still have access to the map WITHOUT waiting for iteration to complete. |
|