E - the type of the objects being permutedjava.util.Iterator<java.util.List<E>>public class PermutationIterator<E>
extends java.lang.Object
implements java.util.Iterator<java.util.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 | Description |
|---|---|
PermutationIterator(java.util.Collection<? extends E> coll) |
Standard constructor for this class.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
hasNext() |
Indicates if there are more permutation available.
|
java.util.List<E> |
next() |
Returns the next permutation of the input collection.
|
void |
remove() |
public PermutationIterator(java.util.Collection<? extends E> coll)
coll - the collection to generate permutations forjava.lang.NullPointerException - if coll is nullpublic boolean hasNext()
hasNext in interface java.util.Iterator<E>public java.util.List<E> next()
next in interface java.util.Iterator<E>java.util.NoSuchElementException - if there are no more permutationspublic void remove()
remove in interface java.util.Iterator<E>Copyright © 2001-2019 - Apache Software Foundation