@ SuppressWarnings ( "unchecked" ) public T [ ] nextPermutationAsArray ( ) { T [ ] permutation = ( T [ ] ) Array . newInstance ( elements . getClass ( ) . getComponentType ( ) , permutationIndices . length ) ; return nextPermutationAsArray ( permutation ) ; }
Generate the next permutation and return an array containing the elements in the appropriate order .