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...

Generate stream of random numbers

Its not possible for any computer to generate real random numbers, but they can generate pseudorandom numbers. Pseudorandom numbers are generated based on an algorithm and they are nearly like...

Quick way to create, read, write and delete files in Java

Files class in java.nio.file package contains static utility methods to operate on files and directories. In this article I will provide information on some of these static methods. These methods...

Quick introduction to PriorityQueue

PriorityQueue is the implementation of Queue interface. Generally queue store elements in FIFO (first in first out) order but PriorityQueue is the exception. As the name specifies, elements in the...

Using comparing methods in Comparator Interface

Java 8 introduced some new methods in Comparator interface. I was going through this interface to check all available methods in it and did some code experiments to understand some...