How to collect more than a single collection or a single scalar

A well-known characteristic of Java Stream is that it can be consumed only once, thus if we want to do some operations that require two passes or more through elements we have to create a new stream or develop a custom collector. Thankfully, Java 12 comes with Collectors::teeing that solves exactly this situation.

How to Organize the Code in the Ports and Adapters Architecture

In this article, we’ll have a look at how to separate an application into different modules so that it can be developed and tested in isolation of any external dependencies. As a result, we’ll obtain loosely coupled components where things like database and communication protocol can easily be replaced without any changes in the domain logic.

Functional Programming Concepts in Java

With the rise of lambda expression and newer features, there is an increasing necessity to review some of the functional programming concepts and how are they applied in Java.

An Introduction to Java Sealed Classes and Interfaces

In this article, we’ll explore what a sealed type in Java is, how to define a class and interface as sealed and finally we’ll go through a practical example.