Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.codehaus.plexus.util.CollectionUtils
public class CollectionUtils
extends java.lang.Object
Method Summary | |
static Map |
|
static Collection |
|
static List |
|
static Map |
|
static Map |
|
static Collection |
|
public static Map getCardinalityMap(Collection col)
Returns aMap
mapping each unique element in the givenCollection
to anInteger
representing the number of occurances of that element in theCollection
. An entry that maps to null indicates that the element does not appear in the givenCollection
.
public static Collection intersection(Collection a, Collection b)
Returns aCollection
containing the intersection of the givenCollection
s. The cardinality of each element in the returnedCollection
will be equal to the minimum of the cardinality of that element in the two givenCollection
s.
- See Also:
Collection.retainAll
public static List iteratorToList(Iterator it)
public static Map mergeMaps(Map dominantMap, Map recessiveMap)
Take a dominant and recessive Map and merge the key:value pairs where the recessive Map may add key:value pairs to the dominant Map but may not override any existing key:value pairs. If we have two Maps, a dominant and recessive, and their respective keys are as follows: dominantMapKeys = { a, b, c, d, e, f } recessiveMapKeys = { a, b, c, x, y, z } Then the result should be the following: resultantKeys = { a, b, c, d, e, f, x, y, z }
- Parameters:
dominantMap
- Dominant Map.recessiveMap
- Recessive Map.
- Returns:
- The result map with combined dominant and recessive values.
public static Map mergeMaps(Map[] maps)
Take a series ofMap
s and merge them where the ordering of the array from 0..n is the dominant order.
- Parameters:
maps
- An array of Maps to merge.
- Returns:
- Map The result Map produced after the merging process.
public static Collection subtract(Collection a, Collection b)
Returns aCollection
containing a - b. The cardinality of each element e in the returnedCollection
will be the cardinality of e in a minus the cardinality of e in b, or zero, whichever is greater.
- See Also:
Collection.removeAll