Optional Static Factories 1. Overview In this article we will discuss 3 different ways to create Optional object. Java has provided us with 3 different […]
Use appropriate data structure to store data
In this article, I will demonstrate why usage of appropriate data structure important and if not selected properly then it can cause slowness in our […]
Files class Find method
1. Overview In this article we will look at Files class’s find method. find() method returns the content of directory passed in parameter based on […]
Walking file tree using walk method of Files class.
1. Overview In this article we will look at Files class’s walk method. walk() method returns the content of directory passed in parameter. The contents […]
How toList all files in directory – 6 examples
1. Overview In this article we will look at Files class’s list method. list() method returns the content of directory passed in parameter. The contents […]
Read all lines of the file lazily in Java 8 with examples.
1. Read all lines of the file lazily lines() method allows us to read file line by line lazily i.e. It returns Stream<String>. 2. lines() […]
Read all lines of the file using Files.readAllLines method
1. readAllLines method Method signature readAllLines method is an overloaded method in Files class. Let’s first see the method version that added prior to Java […]
BufferedReader and BufferedWriter Methods in Java 8 with examples
1. Introduction In this article we will learn how to use newBufferedReader and newBufferedWriter method that was introduced in Files class in Java 8. There […]