Hello Narendra,
There are 2 types of implementation available for
thread safety, 1) CopyOnArrayList or Collections.synchrnozied* 2) ConcurrentAPIs.
Both provides thread safety but basic difference in their locking mechanism.
Type 1 uses synchronized keyword and makes all the method synchronized that means only 1 thread can access the API at one time. This results
performance issue when several threads are involved.
Type 2 uses bucket approach. In this default 16 buckets are used and each bucket is individual locked. So threads in different buckets can work
together which then improves performance. Only particular bucket is locked instead of complete lock on map.