ConcurrentHashMap
- Concurrent replacement of HashMap (uses hash based Map)
- Avoid synchronizing every method on a common lock.
- Many reading threads can access the map concurrently.
- Readers can access the map concurrently with writers.
- A limited number of writers can modify the map concurrently.
- Iterators dont throw ConcurrentModificationException.
- Cannot be locked for exclusive access ; Cannot use client-side locking to create atomic operations
CopyOnWriteArrayList
- Concurrent replacement of ArrayList
- Create a copy every time it is modified (Cost of memeory), so cannot throw ConcurrentModificationException
- Multiple threads can iterate it
No comments:
Post a Comment
Note: only a member of this blog may post a comment.