Varargs, method reference and SAM conversion

Rémi Forax forax at univ-mlv.fr
Tue Jan 11 02:48:38 PST 2011


  There is no special support of varargs method reference.
But it will be cool if the following code was legal.

interface PrintTwoStrings {
   void print2Strings(String format, String value);
}
PrintTwoStrings  pts = System.out#printf; // printf is declared 
Printf(String, Object...)
pts.print2Strings("%s", "foo");

It seems that JSR 292 will be able to support this feature without 
supplementary runtime cost.

Rémi


More information about the lambda-dev mailing list