The concurrent collection classes provide more scalability and performance than other collection classes, such as HashMap or Hashtable. The following are useful concurrent classes provided in the java.util.concurrent package:
- ConcurrentHashMap: This is similar to HashMap and Hashtable, but it has been designed to work in concurrent programming without the need for explicit synchronization. Hashtable and ConcurrentHashMap are both thread-safe collections, but ConcurrentHashMap is more advanced than Hashtable. It does not lock the entire collection for synchronization, so it is very useful when there are a lot of updates and fewer concurrent reads.
- BlockingQueue: The producer-consumer pattern is the most common ...