public final class CollectionUtil extends Object
| 构造器和说明 |
|---|
CollectionUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
allUnique(Collection<?> collection) |
static <T> boolean |
hasIntersection(List<T> first,
Set<T> second) |
static <T> boolean |
hasIntersection(Set<T> first,
Set<T> second) |
static <T> Collection<T> |
intersect(Collection<T> first,
Collection<T> second)
Find the intersection of two collections, the original collections
will not be modified
|
static <T> Collection<T> |
intersectWithModify(Collection<T> first,
Collection<T> second)
Find the intersection of two collections, note that the first collection
will be modified and store the results
|
static <T> boolean |
prefixOf(List<T> prefix,
List<T> all) |
static <T> Set<T> |
subSet(Set<T> original,
int from,
int to)
Get sub-set of a set.
|
static <T> List<T> |
toList(Object array) |
static <T> Set<T> |
union(Collection<T> first,
Collection<T> second) |
public static boolean allUnique(Collection<?> collection)
public static <T> Set<T> subSet(Set<T> original, int from, int to)
T - element type of setoriginal - original setfrom - index of start positionto - index of end position(exclude), but -1 means the last elementpublic static <T> Set<T> union(Collection<T> first, Collection<T> second)
public static <T> Collection<T> intersect(Collection<T> first, Collection<T> second)
T - element type of collectionfirst - the first collectionsecond - the second collectionpublic static <T> Collection<T> intersectWithModify(Collection<T> first, Collection<T> second)
T - element type of collectionfirst - the first collection, it will be modifiedsecond - the second collectionCopyright © 2018. All rights reserved.