Package org.apache.commons.collections4
Class CollectionUtils.CardinalityHelper<O>
- java.lang.Object
-
- org.apache.commons.collections4.CollectionUtils.CardinalityHelper<O>
-
- Type Parameters:
O
- the element type
- Direct Known Subclasses:
CollectionUtils.SetOperationCardinalityHelper
- Enclosing class:
- CollectionUtils
private static class CollectionUtils.CardinalityHelper<O> extends java.lang.Object
Helper class to easily access cardinality properties of two collections.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<O,java.lang.Integer>
cardinalityA
Contains the cardinality for each object in collection A.(package private) java.util.Map<O,java.lang.Integer>
cardinalityB
Contains the cardinality for each object in collection B.
-
Constructor Summary
Constructors Constructor Description CardinalityHelper(java.lang.Iterable<? extends O> a, java.lang.Iterable<? extends O> b)
Create a new CardinalityHelper for two collections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
freqA(java.lang.Object obj)
Returns the frequency of this object in collection A.int
freqB(java.lang.Object obj)
Returns the frequency of this object in collection B.private int
getFreq(java.lang.Object obj, java.util.Map<?,java.lang.Integer> freqMap)
int
max(java.lang.Object obj)
Returns the maximum frequency of an object.int
min(java.lang.Object obj)
Returns the minimum frequency of an object.
-
-
-
Method Detail
-
max
public final int max(java.lang.Object obj)
Returns the maximum frequency of an object.- Parameters:
obj
- the object- Returns:
- the maximum frequency of the object
-
min
public final int min(java.lang.Object obj)
Returns the minimum frequency of an object.- Parameters:
obj
- the object- Returns:
- the minimum frequency of the object
-
freqA
public int freqA(java.lang.Object obj)
Returns the frequency of this object in collection A.- Parameters:
obj
- the object- Returns:
- the frequency of the object in collection A
-
freqB
public int freqB(java.lang.Object obj)
Returns the frequency of this object in collection B.- Parameters:
obj
- the object- Returns:
- the frequency of the object in collection B
-
getFreq
private int getFreq(java.lang.Object obj, java.util.Map<?,java.lang.Integer> freqMap)
-
-