
Finding Max/Min of a List or Collection
1. Introduction A quick intro on how to find the min/max value from a given list/collection with the powerful Stream API in Java8. 2. Find Max in […]
1. Introduction A quick intro on how to find the min/max value from a given list/collection with the powerful Stream API in Java8. 2. Find Max in […]
1. Overview Converting List to Map is a common task. In this tutorial, we’ll cover several ways to do this. We’ll assume that each element of the List has an identifier that […]
1. Overview This short article will show how to convert the values of a Map to an Array, a List or a Set using plain Java as well as a quick Guava based example. 2. Map […]
1. Overview In this quick tutorial, we’ll take a look at the conversion between a List and a Set, starting with Plain Java, using Guava and the Apache Commons Collections library, and […]
1. Overview In this quick tutorial, we’re going to learn how to convert between an Array and a List using core Java libraries, Guava and Apache Commons […]
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. 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 […]
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 […]
1. Overview In this short tutorial, we’ll learn how to convert an Iterator to a List in Java. We’ll cover a few examples using a while loop, Java 8, […]
1. Introduction In a SQL statement, we can use the IN operator to test whether an expression matches any value in a list. Therefore, we […]