Is there a way to refer static method that returns void?
i've tried this
public Function<Runnable, Void> runner = Platform::runLater;
but it will say "bad return type, cannot convert void to java.lang.Void"
1 Answer 1
If your method has no return value, don't use the Function interface.
Use Consumer<Runnable> instead.
public Consumer<Runnable> runner = Platform::runLater;
It represents an operation that accepts a single input argument and returns no result.
answered Oct 23, 2014 at 9:04
Eran
395k57 gold badges726 silver badges793 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
lang-java