Package org.dashbuilder.common.client
Class CollectionUtils
- java.lang.Object
-
- org.dashbuilder.common.client.CollectionUtils
-
public class CollectionUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description CollectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MapgetCardinalityMap(Collection coll)Returns aMapmapping each unique element in the givenCollectionto anIntegerrepresenting the number of occurrences of that element in theCollection.static Collectionintersection(Collection a, Collection b)Returns aCollectioncontaining the intersection of the givenCollections.
-
-
-
Method Detail
-
intersection
public static Collection intersection(Collection a, Collection b)
Returns aCollectioncontaining the intersection of the givenCollections.The cardinality of each element in the returned
Collectionwill be equal to the minimum of the cardinality of that element in the two givenCollections.- Parameters:
a- the first collection, must not be nullb- the second collection, must not be null- Returns:
- the intersection of the two collections
-
getCardinalityMap
public static Map getCardinalityMap(Collection coll)
Returns aMapmapping each unique element in the givenCollectionto anIntegerrepresenting the number of occurrences of that element in theCollection.Only those elements present in the collection will appear as keys in the map.
- Parameters:
coll- the collection to get the cardinality map for, must not be null- Returns:
- the populated cardinality map
-
-