今天遇到一個不認識的語法,記錄一下:
貼一個stackoverflow的答案:
public class R<T extends Comparable>
This means that the type parameter must support comparison with other instances of its own type, via the Comparable interface.
( 這句話的大概意思就是你的泛型參數必須實現Comparable接口來達到自己的泛型實例之間能相互比較的目的。
An example of such a class is provided in the Oracle tutorial Object Ordering. Note the similar pattern to T extends Comparable in the excerpt below:
public class Name implements Comparable {
…
public int compareTo(Name n) { … }
}