public class CollectionUtil extends Object
| 限定符 | 构造器和说明 |
|---|---|
private |
CollectionUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E extends CloneSupport<E>> |
cloneArrayList(List<E> list) |
static <K,V> V |
computeIfAbsent(Map<K,V> concurrentHashMap,
K key,
Function<? super K,? extends V> mappingFunction)
主要是用于修复 concurrentHashMap 在 jdk1.8 下的死循环问题
|
static boolean |
isEmpty(Collection<?> collection) |
static boolean |
isEmpty(Map<?,?> map) |
static boolean |
isNotEmpty(Collection<?> collection) |
static boolean |
isNotEmpty(Map<?,?> map) |
static <T> List<T> |
merge(List<T> list,
List<T> other)
合并 list
|
static <E> ArrayList<E> |
newArrayList(Collection<E> collection) |
static <T> List<T> |
newArrayList(T... elements) |
static <K,V> HashMap<K,V> |
newHashMap() |
static <K,V> HashMap<K,V> |
newHashMap(Map<K,V> map) |
static <T> Set<T> |
newHashSet(T... elements) |
static String[] |
toArrayString(Collection<?> collection) |
static <T> List<T> |
toList(Collection<T> collection) |
private CollectionUtil()
public static boolean isEmpty(Collection<?> collection)
public static boolean isNotEmpty(Collection<?> collection)
public static boolean isNotEmpty(Map<?,?> map)
public static <K,V> HashMap<K,V> newHashMap()
public static <K,V> V computeIfAbsent(Map<K,V> concurrentHashMap, K key, Function<? super K,? extends V> mappingFunction)
public static <T> List<T> toList(Collection<T> collection)
public static String[] toArrayString(Collection<?> collection)
public static <E extends CloneSupport<E>> List<E> cloneArrayList(List<E> list)
public static <T> Set<T> newHashSet(T... elements)
public static <T> List<T> newArrayList(T... elements)
public static <E> ArrayList<E> newArrayList(Collection<E> collection)
public static <K,V> HashMap<K,V> newHashMap(Map<K,V> map)
Copyright © 2024. All rights reserved.