DZone

In my previous article, you can see that I am quite fond of Optional class. Probably many of you agree with me that it is very useful and provides a lot of options. As of now, it consists of approx. 500 lines of code and 20 methods with a public access level (including hashCode, equals, toString, and Javadocs) with various possibilities. 

Today, I will show you what this API evolution looks like through the subsequent Java releases and what were the reasons for its introduction to Java. I hope that it will give you some more knowledge about Optional class itself, help to convince your coworkers to start using it instead of a simple null check or even to decide which Java version to use in your company or private project.

Source: DZone