Collections
-
Core Java
Consuming java.util.concurrent.BlockingQueue as rx.Observable
Classical producer-consumer pattern is relatively simple in Java since we have java.util.concurrent.BlockingQueue. To avoid busy waiting and error-prone manual locking…
Read More » -
Core Java
Transforming Collections
Did you ever want to substitute the equals and hashCode methods a HashSet or HashMap uses? Or have a List…
Read More » -
Core Java
Simple benchmarking : Immutable Collections VS Persistent Collections
Often you need to add new elements to a collection. Because you are a good and careful developer you want…
Read More » -
Core Java
How to Use Java 8 Streams to Swiftly Replace Elements in a List
Imagine you have a list of items: List<String> books = Arrays.asList( "The Holy Cow: The Bovine Testament", "True Hip Hop",…
Read More » -
Core Java
Transforming Collections with Decorators
The Decorator Pattern Ever since first learning the programming design patterns, the decorator pattern has been my favorite. It seemed…
Read More » -
Core Java
Stream-Powered Collections Functionality in JDK 8
This post presents application of JDK 8 – introduced Streams with Collections to more concisely accomplish commonly desired Collections-related functionality.…
Read More » -
Core Java
How to use CopyOnWriteArraySet in Java with Example
CopyOnWriteArraySet is little brother of CopyOnWriteArrayList class. These are special purpose collection classes which was added on JDK 1.5, along…
Read More » -
Core Java
Code4ReferenceList Recently Used(LRU) implementation using LinkedHashMap
Recently I stumbled on one of the Java interview questions: “Implement List-Recently-Used (LRU) Cache using Java collection class?” If you…
Read More » -
Core Java
HashMap performance improvements in Java 8
HashMap<K, V> is fast, versatile and ubiquitous data structure in every Java program. First some basics. As you probably know,…
Read More »