Java CopyOnWriteArraySet example. This class is a thread-safe variant of HashSet which uses a underlying CopyOnWriteArrayList for all of its operations.
Java CopyOnWriteArrayList is a thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array. It’s immutable snapshot style iterator method uses a reference to the state of the array at the point that the iterator was created. This helps in […]
Java TransferQueue is a concurrent blocking queue implementation in which producers may wait for receipt of messages by consumers. LinkedTransferQueue class is an implementation of TransferQueue in Java. TransferQueue may be useful for example in message passing applications in which producers sometimes (using method transfer()) await receipt of elements by consumers invoking take or poll, […]
ArrayBlockingQueue class is Java concurrent and bounded blocking queue implementation backed by an array. It orders elements FIFO (first-in-first-out). The head of the ArrayBlockingQueue is that element that has been on the queue the longest time. The tail of the ArrayBlockingQueue is that element that has been on the queue the shortest time. New elements […]
Java PriorityBlockingQueue class is concurrent blocking queue data structure implementation in which objects are processed based on their priority. The “blocking” part of the name is added to imply the thread will block waiting until there’s an item available on the queue.