public class CollectionUtils extends Object
Collection instances.| 构造器和说明 |
|---|
CollectionUtils()
CollectionUtils should not normally be instantiated. |
| 限定符和类型 | 方法和说明 |
|---|---|
static Map |
getCardinalityMap(Collection coll)
Returns a
Map mapping each unique element in the given Collection to an Integer
representing the number of occurrences of that element in the Collection. |
static boolean |
isEmpty(Collection coll)
Null-safe check if the specified collection is empty.
|
static boolean |
isEqualCollection(Collection a,
Collection b)
Returns true iff the given
Collections contain exactly the same elements with exactly the same
cardinalities. |
static Collection |
subtract(Collection a,
Collection b)
Returns a new
Collection containing a - b. |
public CollectionUtils()
CollectionUtils should not normally be instantiated.public static Collection subtract(Collection a, Collection b)
Collection containing a - b. The cardinality of each element
e in the returned Collection will be the cardinality of e in a minus the
cardinality of e in b, or zero, whichever is greater.a - the collection to subtract from, must not be nullb - the collection to subtract, must not be nullCollection.removeAll(java.util.Collection<?>)public static Map getCardinalityMap(Collection coll)
Map mapping each unique element in the given Collection to an Integer
representing the number of occurrences of that element in the Collection.
Only those elements present in the collection will appear as keys in the map.
coll - the collection to get the cardinality map for, must not be nullpublic static boolean isEqualCollection(Collection a, Collection b)
Collections contain exactly the same elements with exactly the same
cardinalities.
That is, iff the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b.
a - the first collection, must not be nullb - the second collection, must not be nulltrue iff the collections contain the same elements with the same cardinalities.public static boolean isEmpty(Collection coll)
Null returns true.
coll - the collection to check, may be nullCopyright © 2018–2021 Alibaba Group. All rights reserved.