Search code examples
javaoption-typejep

Is there a JEP for Optional?


I like to learn about Java's features by taking a look at the corresponding JEP. Is there a JEP for Java's Optional? I wasn't able to find anything searching this list for Java 8 features.


Solution

  • No, there is no separate JEP for Optional. The history of Optional is the following.

    The Java Specification Request 335 dealt with Lambda Expressions for the Java™ Programming Language. Its goal was:

    Extend the Java language to support compact lambda expressions (closures), as well as related language and library features to enable the Java SE APIs to use lambda expressions effectively.

    It was this context which lead to the inclusion of Optional in Java 8.

    Members of the expert group for JSR-335 and strongly involved in the multiple discussions about Optional were people like Brian Goetz, Doug Lea and Rémi Forax. Chiming in were known experts like Joshua Bloch, Tim Peierls and others.

    The archive of the lambda-libs-spec-experts mailing list contains opinion exchange about Optional.

    So, Optional were added as a result of JSR 335. This information was taken from here. There you can find details.