
A Guide to Java HashMap
1. Overview In this article, we’ll see how to use HashMap in Java, and we’ll look at how it works internally. A class very similar to HashMap is Hashtable. Please […]
1. Overview In this article, we’ll see how to use HashMap in Java, and we’ll look at how it works internally. A class very similar to HashMap is Hashtable. Please […]
1. Overview In this article, we’ll dive into HashSet. It’s one of the most popular Set implementations as well as an integral part of the Java Collections Framework. 2. […]
1. Overview In this article, we’ll have a look at an integral part of the Java Collections Framework and one of the most popular Set implementations – the TreeSet. […]
1. Introduction In this tutorial, we’ll implement two linked list reversal algorithms in Java. 2. Linked List Data Structure A linked list is a linear data structure in […]
1. Overview Finding differences between collections of objects of the same data type is a common programming task. As an example, imagine we have a […]
1. Overview In this short tutorial, we’ll look at some different ways to count the duplicated elements in an ArrayList. 2. Loop with Map.put() Our expected result […]
1. Overview In this tutorial, we’ll learn how to retrieve the intersection of two Lists. Like many other things, this has become much easier thanks to the introduction […]
1. Introduction Iterating over the elements of a list is one of the most common tasks in a program. In this tutorial, we’re going to […]
1. Overview In this super-quick tutorial, we’ll show how to remove the first element from a List. We’ll perform this operation for two common implementations of […]
1. Overview of ArrayList In this quick tutorial, we’ll show to how to add multiple items to an already initialized ArrayList. For an introduction to the use […]
1. Introduction In Java, it’s straightforward to remove a specific value from a List using List.remove(). However, efficiently removing all occurrences of a value is much harder. In this tutorial, […]
1. Overview In this quick tutorial, we’ll show different ways to copy a List to another List and a common error produced in the process. For an introduction to […]
1. Overview In this quick tutorial, we’ll discuss a common Exception that can occur when working with some the API of most List implementations – the UnsupportedOperationException. A java.util.List has more functionality than […]
1. Overview Finding an element in a list is a very common task we come across as developers. In this quick tutorial, we’ll cover different […]
1. Introduction In this short article we’ll focus on the common problem of testing if two List instances contain the same elements in exactly the same order. […]
This quick tutorial is going to show how to remove all null elements from a List, using plain Java, Guava, the Apache Commons Collections and the newer Java 8 lambda […]
In this quick tutorial we’re going to show how to clean up the duplicate elements from a List – first using plain Java, then Guava, and finally […]
1. Remove Nulls From a List Using Plain Java The Java Collections Framework offers a simple solution for removing all null elements in the List – a basic while loop: Alternatively, we […]
1. Overview In this tutorial I will illustrate how to split a List into several sublists of a given size. For a relatively simple operation, there is […]
1. Introduction Picking a random List element is a very basic operation but not so obvious to implement. In this article, we’ll show the most efficient way […]