I have a class looks like this.
// just followed the T, U, V...
public class Some<T...., U....> {
}
And I need to add an instance method look like this.
// not a static method
// just followed from BiFunction<T, U, R>.class
protected <U, R> R apply(final BiFunction<T, U, R> function,
final U u) {
}
The T
of the method is same as the T
of the class.
But the U
of the method is not necessarily same as the U
of the class.
Should I change one of those U
?
In other words,
Are those two U
same?
No according to the scoping rules those U
are not the same. The U
of the apply
method shadows the one from the class Some
. To avoid confusion I would rename one of those U
s.