I have a class with bunch of methods. In another class, I need to write a method, that handles the input values. To that method, I want to pass the method of the class that I want to call. How can we do that with Java after 1.8?
There are similar questions already, but those usually assume that we can use an interface with a single method, therefore can use lambda expressions, etc.
class MyClass {
    public Object myToString(String a) {
        return new String(a);
    }
    public Object myToString(String a, String b) {
       return new String(a + ", " + b);
    }
    public Object mySum(int a) {
        return new Integer(a);
    }
    public Object mySum(int a, int b) {
        return new Integer(a + b);
    }
}
class Test {
    public Object handleInputs(MyClass myClass, MethodAsParameter theMethod, List<Object> inputs) {
        if (type of inputs are Strings) {
            myClass.myToString(inputs.get(0));
        } else if (.....) {
            myClass.mySum(inputs.get(0));
        }
    }
}
 
     
     
    