How to work with sets in Java

Hello! This post describes Java implementation of set concept (collections without duplicates) and provides an overview of common operations with java.util.Set. Set as a data structure In computer programming, set is an implementation of the mathematical concept of (finite) set. It can be defined as a collection of elements with […]

Queues data structure in Java

Hello! This post explores queues in Java and covers core queues operations. Queue as a data structure Before going to concrete implementations of queue data structure in Java, let review first a scientific definition of queue. In computer science, queue stands for a linear collection of elements that are inserted […]

The ultimate guide to java.util.Optional class

Hello! This post covers a topic of using java.util.Optional. This class provides a container that may or may not contain same value. In the article you can find theoretical aspects, approaches to create new Optional instance and methods. Introducing Java Optional The concept of optional is not something new and […]

Common AssertJ assertions for Java collections

Hello! As part of Java collection series, I decided to write this small post to list some of most common assertion methods, that can be used in unit tests to work with Java collections. Common collection assertions This section presents most common assertions, used with Java collections. Examples are illustrated […]

Array based lists in Java (java.util.List)

Hello! This post provides a comprehensive review of array-based lists in Java Collections Framework and presents important lists operations. List as a data structure Before we will progress to concrete list implementations, let take a moment and understand what is a list. From a technical point of view, list is […]

What every developer should know about java.util.Collection

Hello! This post provides an overview of java.util.Collection interface, that is a root for all Java Collections Framework (except of maps). What are Java collections? This section provides a helicopter view on Java Collections Framework. It offers for developers a unified architecture for representing and manipulating collections, enabling collections to […]

Write unit tests with JUnit5 platform

Hello! This article provides a solid introduction to writting Java unit tests with the JUnit5 platform. What is unit testing? Unit testing is a level of software testing, when we test individual software components in isolation. For example, we have UserService, that may have various connected dependencies: UserRepository component to […]

Guide to Streams in Java (including after 8)

Hello! This post provides an overview of streams API in Java. It introduces a concept of stream, how to build pipelines and explores common intermediate and terminal operations. What is stream in Java? Streams were introduced in Java 8 and were updated in next releases. Documentation describes a stream as […]