Appendix A. Using Java 8 functional features
When Java 8 was released, it was presented by Oracle as a step towards more-functional programming. Among the functional-friendly features listed in Oracle’s “What’s New in JDK 8” note were the following:
- “Lambda Expressions, a new language feature, has been introduced in this release. They enable you to treat functionality as a method argument, or code as data. Lambda expressions let you express instances of single-method interfaces (referred to as functional interfaces) more compactly.” This is a very important aspect of the functional paradigm.
- “Method references provide easy-to-read lambda expressions for methods that already have a name.” The latter part of that sentence probably refers to “existing methods,” because methods that don’t already have a name don’t exist.
- “Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration.”
- “Improved type inference.”
- “Classes in the new java.util.stream package provide a Stream API to support functional-style operations on streams of elements. The Stream API is integrated into the Collections API, which enables such as sequential or parallel map-reduce transformations.”
You can read these statements (along with many others not related to functional programming) in Oracle’s original “What’s new in JDK 8” document (http://mng.bz/27na).
In this presentation, Oracle didn’t list several elements and omitted one important fact: