Implementing class of ConcurrentMap.
Constructor signatures:
(): default capacity is 16, default load factor is 0.75
(capacity in int, load factor in float): how many entries it can store, if load factor is exceeded, the map is moved to an other map with double size
(other Map class): converting from that map to HashMap; need identical pair types
EXAMPLE FOR CREATING INSTANCE BY USING CONSTRUCTOR:
EXAMPLE FOR CONVERSION:
All methods of Map are available. Specific methods are below.
EXAMPLE FOR FOREACH(), SEARCH() AND REDUCE():
Differences between ConcurrentHashMap and HashMap:
ConcurrentHashMap is thread-safe, HashMap is not
ConcurrentHashMap provides methods for bulk operations like forEach(), search() and reduce(), HashMap does not
ConcurrentHashMap is divided into 16 segments which allows 16 thread accesses parallel. Handles it in case more threads want to access the map at the same time.
It provides its own synchronization.