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 […]
Bridge Pattern using ApplicationContextAware.
1. Overview In this article, we will learn about building a bridge in an application that needs to be spring enabled. 2. Why develop a […]
Writing Unit Tests in Spring Boot.
1. Overview In this article, I will discuss on how to write unit tests in spring boot. Assumption here is that we are using dependency […]
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 […]
Implementing Validators in Spring using Dependency Injection.
If you want to watch the video for this blog. Click here. 1. Overview In this article I will discuss a validator pattern which will […]
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, […]