public class SetUtils extends Object
| 构造器和说明 |
|---|
SetUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected static <T> T |
checkNotNull(T reference,
String errorMessage)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static <E> List<E> |
difference(Collection<? extends E> set1,
Collection<? extends E> set2)
Returns a list of the difference of two sets.
|
static <E> List<E> |
union(Collection<? extends E> set1,
Collection<? extends E> set2)
Returns a list of the union of two sets.
|
protected static <T> T checkNotNull(T reference,
String errorMessage)
reference - an object referenceerrorMessage - the exception message to use if the check failsNullPointerException - if reference is nullpublic static <E> List<E> difference(Collection<? extends E> set1, Collection<? extends E> set2)
set1 and
not contained by set2. set2 may also contain elements not
present in set1; these are simply ignored. The iteration order of
the returned set matches that of set1.public static <E> List<E> union(Collection<? extends E> set1, Collection<? extends E> set2)
set1, then over each element of set2, in order, that is not
contained in set1.
Note: The returned view performs better when set1 is the
smaller of the two sets. If you have reason to believe one of your sets
will generally be smaller than the other, pass it first.
Copyright © 2018. All rights reserved.