public class CollectionUtils extends Object
Constructor and Description |
---|
CollectionUtils() |
Modifier and Type | Method and Description |
---|---|
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 Collection |
intersection(Collection a,
Collection b)
Returns a
Collection containing the intersection
of the given Collection s. |
public static Collection intersection(Collection a, Collection b)
Collection
containing the intersection
of the given Collection
s.
The cardinality of each element in the returned Collection
will be equal to the minimum of the cardinality of that element
in the two given Collection
s.
a
- the first collection, must not be nullb
- the second collection, must not be nullpublic 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 nullCopyright © 2012–2020 JBoss by Red Hat. All rights reserved.