fix bugs.

feature/net-util
ZhouXY108 2023-06-28 01:29:37 +08:00
parent a641144fbe
commit 9a078396cd
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ public class MoreCollections {
return toConcurrentHashMap(c, keyGenerator, c.size());
}
public static <K, V> TreeMap<K, V> toTreeMap(Iterable<V> c, Function<? super V, K> keyGenerator) {
public static <K extends Comparable<? super K>, V> TreeMap<K, V> toTreeMap(Iterable<V> c, Function<? super V, K> keyGenerator) {
TreeMap<K, V> map = new TreeMap<>();
fillIntoEmptyMap(map, c, keyGenerator);
return map;
@ -106,7 +106,7 @@ public class MoreCollections {
return toConcurrentHashMap(c, keyGenerator, c.length);
}
public static <K, V> TreeMap<K, V> toTreeMap(V[] c, Function<? super V, K> keyGenerator) {
public static <K extends Comparable<? super K>, V> TreeMap<K, V> toTreeMap(V[] c, Function<? super V, K> keyGenerator) {
TreeMap<K, V> map = new TreeMap<>();
fillIntoEmptyMap(map, c, keyGenerator);
return map;