Aricles related to

Java

Java 8: Creating a custom Collector for your Stream

In the previous post we looked at different implementations of the Collector interface. As you saw, there is a wide range of collectors available out of the box. However — sometimes you need something special that you simply have to make yourself. So today we’re going to look at how…


Java 8: Accumulate the elements of a Stream using Collectors

I’ve earlier written about the Stream API and how you can write more declarative code by using it. In this article I want to focus on the different ways of accumulating the elements of a Stream using Collectors. This is made possible by using collect — a method in the…



Java 8: New features in ConcurrentHashMap

The java.util.concurrent got a massive overhaul with the release of Java 8. We’ve been introduced to whole new classes like CompletableFuture that brought a long awaited improvement to asynchronous work. We’ve also seen a lot of new methods being introduced in already existing classes and interfaces…


Java 8: Writing asynchronous code with CompletableFuture

Java 8 introduced a lot of cool features, whereas lambdas and streams caught much of the attention. What you may have missed is the CompletableFuture. You probably already know about Futures A Future represents the pending result of an asynchronous computation. It offers a method — get — that returns the result…


Java 8: Removing null checks with Optional

If-statements are all around us and a big amount of them are simply checking if a value is there or not. If we now for a minute move away from this imperative way of thinking - why should we have to explicitly explain how to do a null check? Why…