The purpose of an object of Optional class is to avoid returning null as it may cause NullPointerException. Instead, an Optional object provides methods that allow checking the presence of a value and substituting it with a predefined value if the return value is null.
The post Java streams 21. Class Optional appeared first on Nick Samoylov, programmer and writer.
Published on March 21, 2020 15:39