15.13 Method Reference Expressions

A method reference expression is used to refer to the invocation of a method without actually performing the invocation. Certain forms of method reference expression also allow class instance creation (§15.9) or array creation (§15.10) to be treated as if it were a method invocation.

MethodReference:   ExpressionName :: [TypeArguments] Identifier   ReferenceType :: [TypeArguments] Identifier   Primary :: [TypeArguments] Identifier   super :: [TypeArguments] Identifier   TypeName . super :: [TypeArguments] Identifier   ClassType :: [TypeArguments] new   ArrayType :: new

If TypeArguments is present to the right of ::, then it is a compile-time error if any of the type arguments are wildcards (§4.5.1).

If a method ...

Get The Java® Language Specification, Java SE 8 Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.