Java Multithreading, Concurrency, and Parallelism — Part 17.5
Understanding Treeifying of HashMaps
In the previous part, we have seen how the ConcurrentHashMap
offers better performance than Collections.synchronizedMap()
with a simple test. Here we will understand one of the important performance enhancements done in Java8 HashMap
and ConcurrentHashMap
. This enhancement that we are talking about is NOT really related to thread safety but about reducing the complexity of searching for a key in a particular bin — The TreeNodes.
Note: For you to understand this…