Java TreeMap vs HashMap 1. Introduction In this article, we’re going to compare two Map implementations: TreeMap and HashMap. Both implementations form an integral part of the Java Collections Framework and store data as key-value pairs. 2. Differences ==== 2.1. Implementation We’ll first talk about the HashMap which is a… Continue Reading java-treemap-vs-hashmap

An Introduction to Java.util.Hashtable Class 1. Overview Hashtable is the oldest implementation of a hash table data structure in Java. The HashMap is the second implementation, which was introduced in JDK 1.2. Both classes provide similar functionality, but there are also small differences, which we’ll explore in this tutorial. 2. When to use Hashtable… Continue Reading java-hash-table

Apache Commons Collections BidiMap 1. Overview In this short article, we’ll be looking at an interesting data structure in the Apache Commons Collections library – the BidiMap. The BidiMap adds a possibility of looking up the key using the corresponding value on top of the standard Map interface. 2. Dependencies… Continue Reading commons-collections-bidi-map

Apache Commons Collections MapUtils 1. Introduction MapUtils is one of the tools available in the Apache Commons Collections project. Simply put, it provides utility methods and decorators to work with java.util.Map and java.util.SortedMap instances. 2. Setup Let’s start by adding the dependency: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>4.1</version> </dependency> 3. Utility Methods… Continue Reading apache-commons-map-utils