|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.benchmarks.client.impl.PermutationIterator
public class PermutationIterator
Iterates over all the possible permutations available in a list of Iterables.
The simplest way to iterate over the permutations of multiple iterators is in a nested for loop. The PermutationIterator turns that for loop inside out into a single iterator, which enables you to access each permutation in a piecemeal fashion.
| Nested Class Summary | |
|---|---|
static class |
PermutationIterator.Permutation
A single permutation of all the iterators. |
| Constructor Summary | |
|---|---|
PermutationIterator(java.util.List<? extends java.lang.Iterable<?>> iterables)
Constructs a new PermutationIterator that provides the values for each possible permutation of iterables. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Returns a new Permutation containing the values of the next
permutation. |
static void |
main(java.lang.String[] args)
|
PermutationIterator.Permutation |
next()
|
void |
remove()
|
void |
skipCurrentRange()
Skips the remaining set of values in the bottom Iterable. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PermutationIterator(java.util.List<? extends java.lang.Iterable<?>> iterables)
iterables.
iterables - non-null. Each Iterable must have at least one
element. iterables.size() must be > 1
TODO(tobyr) Consider if empty Iterables ever make sense in the context of
permutations.| Method Detail |
|---|
public static void main(java.lang.String[] args)
public boolean hasNext()
Permutation containing the values of the next
permutation.
hasNext in interface java.util.Iterator<PermutationIterator.Permutation>Permutationpublic PermutationIterator.Permutation next()
next in interface java.util.Iterator<PermutationIterator.Permutation>public void remove()
remove in interface java.util.Iterator<PermutationIterator.Permutation>public void skipCurrentRange()
Iterable. This
method affects the results of both hasNext() and next().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||