• Concurrency
  • Java concurrency: Understanding CopyOnWriteArrayList and CopyOnWriteArraySet

    Java has a huge amount of useful collections and several are made specifically for use in concurrent code like the ConcurrentHashMap. Two sometimes very useful classes are the CopyOnWriteArrayList and CopyOnWriteArraySet. They implement the java.util.List and the java.util.Set interface respectively. Let’s focus on the CopyOnWriteArrayList to understand what it is all about. Contrary to the […]

  • Concurrency
  • How to make Java classes immutable

    Immutable classes have been a hot topic lately. The rise of functional languages who operate mostly on immutable data and the advantage of immutable data when using multiple threads (correct immutable classes are thread safe) have also created a new interest in immutable data in Java. While some languages like Scala encourage (but do not […]