1. Introduction In this article we get the offset of the time zone to its UTC counterpart. For example : PST time zone i.e. America/Los_Angeles […]
Amazing Java 8 features you need to know Part 2
1. Introduction In a previous article we discussed several new features introduced in Java 8. 2. Content In this article we will discuss below features: […]
Amazing Java 8 features you need to know Part 1
1. Introduction Java has changed from its inception numerous times. Be it either API enhancement or compiler changes of generics type systems. We all know […]
3 wrapper families for Collections Class
1. Introduction Collections class is a static utility class which contains tons of methods which provides access to much needed functionality. This functionalities include polymorphic […]
Optional.orElse() vs Optional.orElseGet()
1. Introduction This article is part of ongoing series of Optional. Read about it more here. orElse(T defaultValue) method returns the value from Optional if […]
Optional orElse() family : Getting value out of Optional
1. Introduction In this article, we will look at getting value out of Optional. There are 5 methods provided in Optional class which must be […]
Introduction to Optional
1. Overview In this article, we will explore the need of Optional class that was introduced in Java 8. Prior to Java 8 there were […]
Combining Optional.isPresent() and Optional.get() is an anti-pattern
1. Overview Optional is a great way to make sure whether the result is present. This article primarily discusses one anti-patterns of Optional. There are […]
Optional Class : equals, hashCode and toString methods with examples
1. Overview In this article, we will look at 3 different methods of Optional class which are overridden from Object class. As you would have […]
Collecting data from Optional using Collectors
1. Overview In this article we will convert Optional<T> to Collection. Let us first understand the use-case here. Optional can contain either 0 or 1 […]
Optional Class : filter, map and flatMap : Filtering and Transforming Optional value.
1. Overview In this article, we will look at 3 different methods of Optional class. These methods are helpful in taking an action on value, […]
Optional Class ifPresent() family : Taking action on value in Optional.
1. Overview In this article, we will look at 2 different methods of Optional class. These methods are helpful in taking an action on value, […]
How to create Optional object?
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 […]