'Do WildCards+Lower Bounds need to be duplicated when calling helper methods?
Suppose we have the following function:
public <T extends Comparable<? super T>> void QuickSort(ArrayList<T> arr)
If in theory, the method later calls a helper method which also needs to use Comparable, does the helper method need the "<T extends Comparable<? super T>>" syntax?
My understanding might be incomplete, but from what I understand about generics, wildcards and lower bounds are used to catch errors at compile time and allow for child classes which have not implemented compareTo to be used. My thinking is that if this is the case, maybe multiple layers of <T extends Comparable<? super T>> are not necessary.If this question is not clear in any way, please let me know.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
