I would so much rather like to write this:
Lists.transform(vals,
new Function<>() {
public List<ValEntry> apply(Validator<? super T> input) {
return input.validate(value);
}
});
...than this:
Lists.transform(vals,
new Function<Validator<? super T>, List<ValEntry>>() {
public List<ValEntry> apply(Validator<? super T> input) {
return input.validate( value );
}
});
But the Java compiler gives me the following error message:
'<>' cannot be used with anonymous classes
Is there a fundamental reason for this? Or did the just skip the feature in JDK 7, maybe they do it in 8?