Java8 Optional class, usage and advantages ?
The Optional class was introduced in Java 8 as a way to handle the null values in a cleaner and more elegant way. The Optional class is a…
Press Esc to close
Archive
The Optional class was introduced in Java 8 as a way to handle the null values in a cleaner and more elegant way. The Optional class is a…
If you don't know how to search files with specific extensions in a directory, then read this page carefully. Here we have shared the easiest ways to search…
Now there is a frequent scenario to convert Iterable to Stream as we are dealing with JPA repositories. Most of the JPA findByXXX methods return Iterable type. Convert…
The current sorting implementations provided by the Java Collection Framework, i.e. Collections.sort and Arrays.sort sequentially performs the sorting. In this tutorial, we will see how to sort an…
In this tutorial, we will see different ways to convert InputStream to String in java. How to Convert InputStream to String: Converting InputStream to String is a very…
In this tutorial, we will see how Java 8 Stream Generate Random String and Numbers. Stream generate random String: Stream provides generate method - It returns an infinite…
Getting Min and Max values from a Stream in Java 8 is not a big deal, here we will see how it can be done. Getting Min and…
In this tutorial, we will see how to get Stream count in Java 8 using Stream count and Collector counting methods. How to get Stream count: We can…
Here we will see how to Merge Streams in Java 8. How to Merge Streams: Concatenating of streams in java 8 is achieved by using stream concat() method.…
Updated October 2026. Tested on Java 21. Everything below works on Java 8 and later.
Here we will see how to convert List to String comma separated values using Java 8. List to String Comma Separated: Let's take a simple java List<String>, filled…
In older versions of java like before java 8, we usually iterate for loop using indexes, for example, if we want to print numbers from 0 to 10…
Here I am going to show you how to convert java.util.Date to java.time.LocalDate object. Convert java.util.Date to java.time.LocalDate: We can do this in different solutions. Solution -1 :…
In this tutorial, we will see 5 different ways to iterate ArrayList in java. Iterate ArrayList in Java : Create ArrayList : ArrayList<String> fruitsList = new ArrayList(); fruitsList.add("Banana");…
In this tutorial, I am going to show you how to set JAVA_HOME on Windows10 operating system. Note: Assuming Java8 installed on your local (Windows10) machine, if not,…
In this tutorial, I am going to show you how to concatenate arrays using Java8 streams. Java8 Concatenate Arrays : Array_Concatinate.java import java.util.Arrays; import java.util.stream.Stream; public class Array_Concatinate…
In this tutorial, I am going to show you how to convert Java ArrayList to Array. Java ArrayList to Array : We can convert an ArrayList to array…
In this tutorial, I am going to show you how to check an array contains a specific value in Java 8. Array contains a specific value : Array_Contains.java…
Updated October 2026. Every example was run on Java 21.
In this tutorial, I am going to show you how to read all files in a folder using Java 8 walk syntax. Java 8 How to Read all…