E - the type of the objects being permutedpublic class PermutationIterator<E> extends Object implements Iterator<List<E>>
The iterator will return exactly n! permutations of the input collection.
The remove() operation is not supported, and will throw an
UnsupportedOperationException.
NOTE: in case an empty collection is provided, the iterator will return exactly one empty list as result, as 0! = 1.
| Constructor and Description |
|---|
PermutationIterator(Collection<? extends E> coll)
Standard constructor for this class.
|
public PermutationIterator(Collection<? extends E> coll)
coll - the collection to generate permutations forNullPointerException - if coll is nullpublic boolean hasNext()
public List<E> next()
next in interface Iterator<List<E>>NoSuchElementException - if there are no more permutationsCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.