ConcurrentHashMap
Take a look at ConcurrentHashMap in Java.
We'll cover the following...
- Differences between a ConcurrentHashMap and SynchronizedMap
- Creating a ConcurrentHashMap
- Using the no-arg constructor
- Using the constructor that takes initial capacity
- Using the constructor that takes initial capacity and load factor
- Using the constructor that takes another Map as a parameter
- Using the constructor that takes initial capacity, load factor, and concurrency level as a parameter
- Inserting into a ConcurrentHashMap
We can make our Map thread-safe by using the synchronizedMap()
method of the Collections class. This method returns SynchronizedMap in which all ...