Package org.apache.commons.collections4
Class CollectionUtils.SetOperationCardinalityHelper<O>
- java.lang.Object
-
- org.apache.commons.collections4.CollectionUtils.CardinalityHelper<O>
-
- org.apache.commons.collections4.CollectionUtils.SetOperationCardinalityHelper<O>
-
- Type Parameters:
O
- the element type
- All Implemented Interfaces:
java.lang.Iterable<O>
- Enclosing class:
- CollectionUtils
private static class CollectionUtils.SetOperationCardinalityHelper<O> extends CollectionUtils.CardinalityHelper<O> implements java.lang.Iterable<O>
Helper class for set-related operations, e.g. union, subtract, intersection.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<O>
elements
Contains the unique elements of the two collections.private java.util.List<O>
newList
Output collection.-
Fields inherited from class org.apache.commons.collections4.CollectionUtils.CardinalityHelper
cardinalityA, cardinalityB
-
-
Constructor Summary
Constructors Constructor Description SetOperationCardinalityHelper(java.lang.Iterable<? extends O> a, java.lang.Iterable<? extends O> b)
Create a new set operation helper from the two collections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<O>
iterator()
java.util.Collection<O>
list()
Returns the resulting collection.void
setCardinality(O obj, int count)
Add the objectcount
times to the result collection.-
Methods inherited from class org.apache.commons.collections4.CollectionUtils.CardinalityHelper
freqA, freqB, max, min
-
-
-
-
Method Detail
-
iterator
public java.util.Iterator<O> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<O>
-
setCardinality
public void setCardinality(O obj, int count)
Add the objectcount
times to the result collection.- Parameters:
obj
- the object to addcount
- the count
-
list
public java.util.Collection<O> list()
Returns the resulting collection.- Returns:
- the result
-
-