Java 11 Cookbook
上QQ阅读APP看书,第一时间看更新

There's more...

An object of the Optional class is not serializable and, thus, cannot be used as a field of an object. This is another indication that the designer of the Optional class intended to be used in a stateless process. 

It makes the stream processing pipeline more compact and expressive, focusing on the actual values instead of checking if there are empty elements in the stream.