In java I have the following lambda:
Function<? extends Number, Boolean> f = i -> true;
Next I want to use this lambda the following way:
public <T extends Number> Boolean use(T n) {
return f.apply(n);
}
But the compiler gives 'incompatible types: T cannot be converted to capture#1 of ? extends java.lang.Number'
So what is the reason and how can I use my defined function?