public List < T > getPermutation ( List < T > storage ) { if ( storage == null ) storage = new ArrayList < T > ( ) ; else storage . clear ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { storage . add ( get ( i ) ) ; } return storage ; }
Returns a list containing the current permutation .