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…




Java 8: Composing functions using compose and andThen

In this post we're going to take a look at function composition using two compose functions provided in the Function interface - compose and andThen. What is function composition? It all has to do with creating small reusable functions that you can combine to compose new functions. Now, how can…



Java 8: Replace traditional for loops with IntStreams

I've previously looked at how to work on a higher level by replacing loops with streams. In this post I want to continue this by looking at IntStream and how it could replace the traditional for (int i=0;... loop. IntStream is a stream of primitive int values. It's part…