Java8: Is there a way to get an instance method reference from a class method reference?

Viewed 950

If I have, for instance, an interface like this:

public interface FooBar<A, B> {
    B foo(A a);

    B bar(A a);
}

Is there a way to take a class-level method reference like FooBar::bar and get an instance method reference?

ie. if I have

FooBar myFooBarInstance;
BiFunction<FooBar<A, B>, A, B> barFunction = FooBar::bar;

is there any simple way to get a Function<A,B> instance that would match what I'd get if I defined

Function<A, B> myBarFunction = myFooBarInstance::bar;
2 Answers
Related