Package org.plumelib.util
Class CombinationIterator<T>
java.lang.Object
org.plumelib.util.CombinationIterator<T>
- Type Parameters:
T
- the type of the elements of the collections
Given a set of collections, yield each combination that takes one element from each collection.
Each tuple has a value from each candidate list. Each combination'slength is the same as the
number of input lists.
For instance, given [["a1", "a2"], ["b1"], ["c1", "c2", "c3"]]
, this class yields in
turn:
["a1", "b1", "c1"] ["a1", "b1", "c2"] ["a1", "b1", "c3"] ["a2", "b1", "c1"] ["a2", "b1", "c2"] ["a2", "b1", "c3"]
-
Constructor Summary
ConstructorDescriptionCombinationIterator
(Collection<? extends Collection<T>> collectionsOfCandidates) Creates aCombinationIterator
for lists constructed from the given candidates. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
CombinationIterator
Creates aCombinationIterator
for lists constructed from the given candidates. Each generated list will be the same length as the given list.- Parameters:
collectionsOfCandidates
- lists of candidate values for each position in generated lists
-
-
Method Details
-
hasNext
@EnsuresNonNullIf(expression="nextValue", result=true) public boolean hasNext(@GuardSatisfied CombinationIterator<T> this) -
next
-
remove
public void remove(@GuardSatisfied CombinationIterator<T> this)
-