
Converting Iterator to List
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. 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. Overview Creating a multidimensional ArrayList often comes up during programming. In many cases, there is a need to create a two-dimensional ArrayList or a three-dimensional ArrayList. In this tutorial, we’ll discuss […]
1. Overview In this quick article, we’ll be looking at the CopyOnWriteArrayList from the java.util.concurrent package. This is a very useful construct in the multi-threaded programs – when we […]
1. Overview This quick tutorial will show how to make an ArrayList immutable with the core JDK, with Guava and finally with Apache Commons Collections 4. This article is […]
1. Overview In this article, we’re going to take a look at ArrayList class from the Java Collections Framework. We’ll discuss its properties, common use cases, as […]
1. Introduction LinkedList is a doubly-linked list implementation of the List and Deque interfaces. It implements all optional list operations and permits all elements (including null). 2. Features Below you can […]
1. Introduction Concurrency in Java is one of the most complex and advanced topics brought up during technical interviews. This article provides answers to some […]
1. Introduction The Dining Philosophers problem is one of the classic problems used to describe synchronization issues in a multi-threaded environment and illustrate techniques for solving […]
1. Introduction It is relatively common for Java programs to add a delay or pause in their operation. This can be useful for task pacing […]
1. Overview Java supports multithreading out of the box. This means that by running bytecode concurrently in separate worker threads, the JVM is capable of improving application […]
1. Introduction In this tutorial, we’ll compare CyclicBarrier and CountDownLatch and try to understand the similarities and differences between the two. 2. What Are These? When it comes to […]
1. Overview Generating random values is a very common task. This is why Java provides the java.util.Random class. However, this class doesn’t perform well in a multi-threaded […]
1. Introduction CyclicBarriers are synchronization constructs that were introduced with Java 5 as a part of the java.util.concurrent package. In this article, we’ll explore this implementation in a […]
1. Introduction This tutorial is a guide to the functionality and use cases of the CompletableFuture class that was introduced as a Java 8 Concurrency API improvement. […]
1. Overview The ExecutorService framework makes it easy to process tasks in multiple threads. We’re going to exemplify some scenarios in which we wait for threads to […]
1. Overview Simply put, a lock is a more flexible and sophisticated thread synchronization mechanism than the standard synchronized block. The Lock interface has been around since Java 1.5. […]
1. Introduction In this article, we’ll give a guide to the CountDownLatch class and demonstrate how it can be used in a few practical examples. Essentially, by […]
1. Overview Java 8 introduced the concept of Streams as an efficient way of carrying out bulk operations on data. And parallel Streams can be obtained in environments […]
1. Overview The fork/join framework was presented in Java 7. It provides tools to help speed up parallel processing by attempting to use all available […]
1. Overview ExecutorService is a JDK API that simplifies running tasks in asynchronous mode. Generally speaking, ExecutorService automatically provides a pool of threads and an API for assigning […]