All Posts

Infinite streams

Streams allows us to generate endless progression of discrete objects. There are couple of methods available in Java which will help us to generate infinite sequences.

Recipes for Optional

Optional allows us to wrap a nullable object in it so we can make a method to return Optional instead of bare object. There is a possibility that below method...

Functions cheat sheet

Functional interface will have single abstract method and they provide target types for lambda expressions. There are many functional interfaces in Java and they all are available in java.util.function package....

Reduce stream to single value

Lets say we want to return the sum of all numbers in a list, there are multiple ways in Java we can achieve this, one of the way is using...

Quick way to create List, Set and Map

Java 9 introduced of() static methods in List, Map and Set interfaces. This method will help us to create collection easily. I got surprised to see this method, it is...

Using consumer functional interface

This article will explain the basics of using consumer functional interface. Consume is one of the many available functional interfaces in Java. This interface can be used when we need...

Create Maven project in GitHub

If you are looking to publish your first Maven project to gitHub then this article will help you to get started with that. I am going to explain the steps...

Fixed Thread Pool using Executor framework

In this article we are looking at the Fixed thread pool implementation. This thread pool creates a fixed number of threads and reuses them as the tasks are completed and...

Producer and Consumer with Bounded Blocked Queue

Producer and consumers are two independent entities works together on the queue. Producer inserts elements into the tail of the queue and consumer removes them from the head of the...