public class

PermutationIterator

extends Object
implements Iterator<E>
java.lang.Object
   ↳ com.google.gwt.benchmarks.client.impl.PermutationIterator

Class Overview

Iterates over all the possible permutations available in a list of Iterable 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.

Summary

Nested Classes
class PermutationIterator.Permutation A single permutation of all the iterators. 
Public Constructors
PermutationIterator(List<? extends Iterable<?>> iterables)
Constructs a new PermutationIterator that provides the values for each possible permutation of iterables.
Public Methods
boolean hasNext()
Returns a new Permutation containing the values of the next permutation.
static void main(String[] args)
PermutationIterator.Permutation next()
void remove()
void skipCurrentRange()
Skips the remaining set of values in the bottom Iterable.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Iterator

Public Constructors

public PermutationIterator (List<? extends Iterable<?>> iterables)

Constructs a new PermutationIterator that provides the values for each possible permutation of iterables.

Parameters
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.

Public Methods

public boolean hasNext ()

Returns a new Permutation containing the values of the next permutation.

Returns
  • a non-null Permutation

public static void main (String[] args)

public void remove ()

public void skipCurrentRange ()

Skips the remaining set of values in the bottom Iterable. This method affects the results of both hasNext() and next().