JavaPatternMatching/resources/AllgemeinTest/wildcardPair.jav

22 lines
456 B
Java

import java.util.List;
import java.lang.Integer;
import java.lang.Object;
import java.lang.Boolean;
class wildcardPair {
make(l) {
var p = new Pair(l.get(0), l.get(1));
return p;
}
//<X>Boolean compare(Pair<X, X> x) { return true; }
void m(l) {
Object o = l.get(0);
//Pair<? extends Object, ? extends Object> p;
//List<?> b;
//this.compare(p); //1, type incorrect
make(l);
//this.compare(this.make(b)); //2, OK
}
}