Check If Two Lists are Equal in Java 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. List is an ordered data structure so the order of elements matters by design. have… Continue Reading java-test-a-list-for-ordinality-and-equality

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

Java List Initialization in One Line 1. Introduction In this quick tutorial, we’ll investigate how can we initialize a List using one-liners. Further reading: Collections.emptyList() vs. New List Instance Learn the differences between the Collections.emptyList() and a new list instance. Read more → Guide to the Java ArrayList Quick and practical guide… Continue Reading java-init-list-one-line

Java List UnsupportedOperationException 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 an ordinary array can support. For instance, with only one built-in method call, it’s possible to check if… Continue Reading java-list-unsupported-operation-exception

Converting a Collection to ArrayList in Java 1. Overview Converting Java collections from one type to another is a common programming task. In this tutorial, we’ll convert any type of Collection to an ArrayList. Throughout the tutorial, we’ll assume that we already have a collection of Foo objects. From there, we’ll… Continue Reading java-convert-collection-arraylist