for ( int currentIteratorIndex = iterators.size() - 1; currentIteratorIndex >= 0; --currentIteratorIndex ) {
Iterator it = (Iterator) iterators.get( currentIteratorIndex );
if ( it.hasNext() ) {
values.set( currentIteratorIndex, it.next() );
for ( int i = currentIteratorIndex + 1; i < iterators.size(); ++i ) {
Range resetRange = (Range) ranges.get( i );
Iterator resetIterator = resetRange.iterator();
iterators.set(i, resetIterator);
values.set( i, resetIterator.next() );
}
return new Permutation( values );