Much has been said about Java 8 and about the way it will change the way we design applications and APIs. Of course the fisrt big thing is lambda expressions, followed by the Stream API.
Another element was introduced, the final class Optional
, which also changes the way we can write API and applications, leading us to better and more fluent patterns. The purpose of this article is to detail the concept of optional, and show the available patterns to use optionals efficiently and elegantly. There are very powerful and very elegant way to mix optionals and streams, the aim of this article is to describe those patterns.