What is the type of a "method reference"?

Florian Weimer fweimer at redhat.com
Wed Jun 12 01:22:37 PDT 2013


On 06/11/2013 11:50 PM, Behrooz Nobakht wrote:
> My question is that how should the method doAnotherThing be declared?

In most cases, it is appropriate to define an interface with a single 
method and use it as a parameter type.

> Studying the source code of Java 8, I found out that before Java 8 version
> b75, there was an abstraction java.util.function.Block which was removed
> from further revisions.

There is java.util.function.Function, but it's probably most useful in 
abstract contexts where no reasonably named concrete type is available.

On the question in the subject, method references do not have a type.

-- 
Florian Weimer / Red Hat Product Security Team


More information about the jdk8-dev mailing list