I cannot figure out why this code don't compile :
package Desktop;
import java.util.function.*;
public class MyClass {
public static <T, U> Long myMethod( Function<T, U> methodParam ) {
return methodParam.apply("Today is happy day!");
}
public static void main(String[] args) {
System.out.println( <String, Long>myMethod( Long::valueOf ) );
}
}
So i receive this on console:
..\Desktop\MyClass.java:15: error: illegal start of expression
System.out.println( <String, Long>myMethod( Long::valueOf ) );
^
..\Desktop\MyClass.java:15: error: ';' expected
System.out.println( <String, Long>myMethod( Long::valueOf ) );
^
2 errors
I am expecting to use generics to include type for the lambda on method parameter.