Is there an interface in Java similar to the Callable
interface, that can accept an argument to its call method?
Like so:
public interface M
Define an interface like so:
interface MyFunction {
O call(I input);
}
Define a method:
void getOrderData(final Function func){
...
JSONArray json = getJSONArray();
if(func!=null) func.call(json);
}
Usage example:
//call getOrderData somewhere in your code
getOrderData(new Function() {
@Override
public Void call(JSONArray input) {
parseJSON(input);
return null;
}
});