I want to give a python function as a Consumer for a java method.
public Class MyObject {
public void javaFunction(Consumer<Double> consumer){...}
}
and
def python_function(arg):
some_code_using(arg)
I tried the following:
myObjectInstance.javaFunction(python_function)
and
myObjectInstance.javaFunction(lambda arg: python_function(arg))
Each time, I get 1st arg can't be coerced to java.util.function.Consumer
I've done this before with Suppliers and it worked well. I'm using org.python.util.PythonInterpreter
Any ideas on how to pass such a Consumer ?