HashMap
|
ConcurrentHashMap
|
it is not thread safe.
|
it is Thread safe .
|
Relatively performance high
because thread are not required to wait to operate on HashMap.
|
Relatively performances is low because some time
Thread are required to wait to operate on ConcurrentHashMap.
|
While one thread iterating
HashMap the other Threads are not allowed to modify Map object otherwise we
will get Runtime exception saying ConcurrentModificationException.
|
While one Thread is
iterating ConcurrentHashMap the other Thread are allowed to modify Map
object in safe manner and it won't throws
ConcurrentModificationException.
|
null is allowed for both keys and
values.
|
null is not allowed for both keys and values
.otherwise we will get NullPointerException.
|
introduced in 1.2 version.
|
introduced in 1.5 version.
|
Iterator of HashMap is Fail-Fast
and it throws ConcurrentModificationException.
|
Iterator of ConcurrentHashMap is Fail-Safe and it
won't throws ConcurrentModificationException.
|
13 Feb 2018
Collection