@@ -43,18 +43,18 @@ class Season extends Enum<Season>
43
43
public static <T > T max (Collection<? extends T > coll , Comparator<? super T > cmp ){
44
44
T candidate = coll. iterator(). next();
45
45
for (T elt : coll) {
46
- if (cmp. compare(candidate, elt) < 0 ) { candidate = elt; }
47
- }
46
+ if (cmp. compare(candidate, elt) < 0 ) { candidate = elt; }
47
+ }
48
48
return candidate;
49
49
}
50
50
public static <T extends Comparable<? super T > > T max (Collection<? extends T > coll ){
51
- return max(coll, Comparators . < T > naturalOrder());
52
- }
53
- public static <T > T min (Collection<? extends T > coll , Comparator<? super T > cmp ){
54
- return max(coll, reverseOrder(cmp));
51
+ return max(coll, Comparators . < T > naturalOrder());
55
52
}
56
- public static <T extends Comparable<? super T > > T min (Collection<? extends T > coll ){
57
- return max(coll, Comparators . < T > reverseOrder());
53
+ public static <T > T min (Collection<? extends T > coll , Comparator<? super T > cmp ){
54
+ return max(coll, reverseOrder(cmp));
55
+ }
56
+ public static <T extends Comparable<? super T > > T min (Collection<? extends T > coll ){
57
+ return max(coll, Comparators . < T > reverseOrder());
58
58
}
59
59
public static <T extends Comparable<? super T > > Comparator<T > naturalOrder (){
60
60
return new Comparator<T > () {
@@ -87,7 +87,7 @@ class Season extends Enum<Season>
87
87
public final int ordinal () { return ordinal; }
88
88
public String toString () { return name; }
89
89
public final int compareTo (E o ) {
90
- return ordinal - o. ordinal;
90
+ return ordinal - o. ordinal;
91
91
}
92
92
}
93
93
```
@@ -170,5 +170,5 @@ class Season extends Enum<Season>
170
170
阵列至关重要。请注意,调用 `clone` 方法时不需要强制转换,因为克隆数组现在可以利用协变返回类型(请参见第 `3.8` 节)。 `valueOf` 方法接受一个字符串并
171
171
返回相应的常量,通过搜索内部数组找到。如果字符串没有命名枚举值,它将返回 `IllegalArgumentException `。
172
172
173
- 《《《 [下一节](06_Multiple Bounds .md) <br/>
173
+ 《《《 [下一节](06_Multiple_Bounds .md) <br/>
174
174
《《《 [返回首页](../README .md)
0 commit comments