import java.util.List;
import java.util.Arrays;
interface I {
I interactWith(A other);
I interactWith(I other);
}
class A implements I {
public I interactWith(A other) {
// default implementation
return null;
}
public I interactWith(I other) {
// default implementation
return null;
}
}
class B implements I {
public I interactWith(A other) {
System.out.println("I'd like this to get called");
return null;
}
public I interactWith(I other) {
// default implementation
System.out.println("this get called");
return null;
}
}
class Main {
public static void main(String []args){
List<I> list = Arrays.asList(new A(), new B());
list.get(1).interactWith(list.get(0));
}
}