extend and type inference
Jose
jgetino at telefonica.net
Tue Aug 7 00:01:46 PDT 2012
Build b50
In this simple case the compiler can't infer the type of the variable r:
public static void main(String[] args) {
Iterable<? extends Rectangle2D> it=new ArrayList<>();
Iterable<Integer> originPos=it.map(r->r.outcode(0,0));
}
You must to set the type by hand:
public static void main(String[] args) {
Iterable<? extends Rectangle2D> it=new ArrayList<>();
Iterable<Integer> originPos=it.map((Rectangle2D r)->r.outcode(0,0));
}
More information about the lambda-dev
mailing list