Package com.google.common.collect
Class Collections2.OrderedPermutationIterator<E>
java.lang.Object
com.google.common.collect.UnmodifiableIterator<List<E>>
com.google.common.collect.AbstractIterator<List<E>>
com.google.common.collect.Collections2.OrderedPermutationIterator<E>
- Enclosing class:
Collections2
private static final class Collections2.OrderedPermutationIterator<E>
extends AbstractIterator<List<E>>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidReturns the next element.(package private) int(package private) intfindNextL(int j) Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peekMethods inherited from class com.google.common.collect.UnmodifiableIterator
removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
nextPermutation
-
comparator
-
-
Constructor Details
-
OrderedPermutationIterator
OrderedPermutationIterator(List<E> list, Comparator<? super E> comparator)
-
-
Method Details
-
computeNext
Description copied from class:AbstractIteratorReturns the next element. Note: the implementation must callAbstractIterator.endOfData()when there are no elements left in the iteration. Failure to do so could result in an infinite loop.The initial invocation of
AbstractIterator.hasNext()orAbstractIterator.next()calls this method, as does the first invocation ofhasNextornextfollowing each successful call tonext. Once the implementation either invokesendOfDataor throws an exception,computeNextis guaranteed to never be called again.If this method throws an exception, it will propagate outward to the
hasNextornextinvocation that invoked this method. Any further attempts to use the iterator will result in anIllegalStateException.The implementation of this method may not invoke the
hasNext,next, orAbstractIterator.peek()methods on this instance; if it does, anIllegalStateExceptionwill result.- Specified by:
computeNextin classAbstractIterator<List<E>>- Returns:
- the next element if there was one. If
endOfDatawas called during execution, the return value will be ignored.
-
calculateNextPermutation
void calculateNextPermutation() -
findNextJ
int findNextJ() -
findNextL
int findNextL(int j)
-