Content deleted Content added
→Varargs: Add main article |
→Functional interfaces and lambda expressions: Add link to @FunctionalInterface annotation. |
||
Line 1,451:
====Functional interfaces and lambda expressions====
These features were introduced with the release of Java SE 8. An interface automatically becomes a functional interface if it defines only one method. In this case an implementation can be represented as a lambda expression instead of implementing it in a new class, thus greatly simplifying writing code in the [[functional programming|functional style]]. Functional interfaces can optionally be annotated with the <code>[[@FunctionalInterface]]</code> annotation, which will tell the compiler to check whether the interface actually conforms to a definition of a functional interface.
<syntaxhighlight lang="java">
|