jdk里的泛型
所属分类 java
浏览量 1247
jdk里经典的泛型用法
java.util.Arrays
java.util.Collections
java.util.HashMap
java.util.HashMap
public class HashMap extends AbstractMap
implements Map, Cloneable, Serializable
static class Node implements Map.Entry {
final int hash;
final K key;
V value;
Node next;
public V put(K key, V value)
public void putAll(Map extends K, ? extends V> m)
public V get(Object key)
public Set keySet()
public Collection values()
public Set> entrySet()
java.util.Arrays
public static List asList(T... a) {
return new ArrayList<>(a);
}
public static int binarySearch(T[] a, T key, Comparator super T> c) {
return binarySearch0(a, 0, a.length, key, c);
}
public static T[] copyOfRange(T[] original, int from, int to)
public static void sort(T[] a, Comparator super T> c)
public static Stream stream(T[] array)
public static T[] copyOf(U[] original, int newLength, Class extends T[]> newType) {
@SuppressWarnings("unchecked")
T[] copy = ((Object)newType == (Object)Object[].class)
? (T[]) new Object[newLength]
: (T[]) Array.newInstance(newType.getComponentType(), newLength);
System.arraycopy(original, 0, copy, 0,
Math.min(original.length, newLength));
return copy;
}
public static void parallelSort(T[] a, Comparator super T> cmp)
java.util.Collections
public static final List emptyList() {
return (List) EMPTY_LIST;
}
public static > T max(Collection extends T> coll)
public static void sort(List list, Comparator super T> c)
public static int binarySearch(List extends Comparable super T>> list, T key)
public static int binarySearch(List extends T> list, T key, Comparator super T> c)
public static void reverse(List> list)
public static List singletonList(T o) {
return new SingletonList<>(o);
}
public static List synchronizedList(List list)
public static List unmodifiableList(List extends T> list)
java泛型
java泛型技巧
上一篇
下一篇
fastjson为什么这么多安全漏洞
递归与尾递归java实例
物联网云平台简介
springboot2单元测试
项目管理八大原则
springboot文件上传异常分析及解决方案