<awangdev>46. Permutations_1.java
private void dfs(List<List<Integer>> rst, List<Integer> list, Queue<Integer> queue) {

        if (queue.isEmpty()) {
            rst.add(new ArrayList<>(list));
            return;
        }
        int size = queue.size();
        while (size-- > 0) {
            int val = queue.poll(); 
            list.add(val);

            dfs(rst, list, queue);

            list.remove(list.size() - 1); 
            queue.offer(val);
        }
    }
private void sample_funcname ( List < List < Integer >> rst , List < Integer > list , Queue < Integer > queue ) {
  if ( queue . isEmpty ( ) ) {
    rst . add ( new ArrayList < > ( list ) ) ;
    return ;
  }
  int size = queue . size ( ) ;
  while ( size -- > 0 ) {
    int val = queue . poll ( ) ;
    list . add ( val ) ;
    dfs ( rst , list , queue ) ;
    list . remove ( list . size ( ) - 1 ) ;
    queue . offer ( val ) ;
  }
}
