public List < T > nextPermutationAsList ( ) { List < T > permutation = new ArrayList < T > ( elements . length ) ; return nextPermutationAsList ( permutation ) ; }
Generate the next permutation and return a list containing the elements in the appropriate order .