Initializing HashSet at the Time of Construction 1. Overview In this quick tutorial, we’ll introduce various methods of initializing the HashSet with values, at the time of its construction. If you’re instead looking to explore the features of HashSet, refer to this core article here. We’ll dive into Java built-in methods since Java 5 and before followed… Continue Reading java-initialize-hashset

HashSet and TreeSet Comparison 1. Introduction In this article, we’re going to compare two of the most popular Java implementations of the java.util.Set interface – HashSet and TreeSet. 2. Differences HashSet and TreeSet are leaves of the same branch, but they differ in few important matters. 2.1. Ordering HashSet stores… Continue Reading java-hashset-vs-treeset

Performance of contains() in a HashSet vs ArrayList 1. Introduction In this quick guide, we’re going to discuss the performance of the contains() method available in java.util.HashSet and java.util.ArrayList. They are both collections for storing and manipulating objects. HashSet is a collection for storing unique elements. To learn more about the HashSet,… Continue Reading java-hashset-arraylist-contains-performance

An Introduction to Synchronized Java Collections 1. Overview The collections framework is a key component of Java. It provides an extensive number of interfaces and implementations, which allows us to create and manipulate different types of collections in a straightforward manner. Although using plain unsynchronized collections is simple overall, it… Continue Reading java-synchronized-collections

Combining Different Types of Collections in Java 1. Introduction In this quick tutorial, we’ll explore different ways of combining collections in Java. We’ll explore various approaches using Java and external frameworks like Guava, Apache, etc. For the introduction to Collections, have a look at this series here. 2. External Libraries… Continue Reading java-combine-collections