E - the type of the objects being permutedpublic 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 and Description |
|---|
PermutationIterator(java.util.Collection<? extends E> coll)
Standard constructor for this class.
|
| Modifier and Type | Method and 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<java.util.List<E>>public java.util.List<E> next()
next in interface java.util.Iterator<java.util.List<E>>java.util.NoSuchElementException - if there are no more permutationspublic void remove()
remove in interface java.util.Iterator<java.util.List<E>>Copyright © 2010 - 2023 Adobe. All Rights Reserved