This is valid code as per compiler:
BiPredicate<String, String> bp = String::equalsIgnoreCase;
But if I make my own BiPredicate, it fails to compile.. why?
private void run() {
BiPredicate<String, String> bp = String::equalsIgnoreCase; // compiles!
BiPredicate<String, String> bp2 = MyKlazz::m1; // does not compile!
}
static final class MyKlazz<T, U> {
private T t;
MyKlazz(T t){
this.t = t;
}
public boolean m1(U u){
System.out.println("in m1.. t: " + this.t + ", u: " + u);
return true; // dummy
}
}
1