<awangdev>Subsets II_2.java
public List<List<Integer>> subsetsWithDup(int[] nums) {
        List<List<Integer>> result = new ArrayList<>();
        if (nums == null || nums.length == 0) {
            return result;
        }
        Arrays.sort(nums);
        Queue<List<Integer>> queue = new LinkedList<>();
        List<Integer> initialList = new ArrayList<>();
        queue.offer(initialList);

        while (!queue.isEmpty()) {
            int size = queue.size();

            while (size > 0) {
                List<Integer> indexRow = queue.poll();
                List<Integer> list = new ArrayList<>();
                for (int index : indexRow) {
                    list.add(nums[index]);
                }
                result.add(list);

                int endIndex = indexRow.size() == 0 ?
                    0 : indexRow.get(indexRow.size() - 1) + 1;
                for (int i = endIndex; i < nums.length; i++) {
					if (i > endIndex && nums[i] == nums[i - 1]) { 
						continue;
					}
                    indexRow.add(i);
                    queue.offer(new ArrayList<>(indexRow));
                    indexRow.remove(indexRow.size() - 1);
                }
                size--;
            }
        }
        return result;
    }
public List < List < Integer >> var_2 ( int [ ] var_3 ) {
  List < List < Integer >> var_5 = new ArrayList < > ( ) ;
  if ( var_3 == null || var_3 . length == 0 ) {
    return var_5 ;
  }
  Arrays . sort ( var_3 ) ;
  Queue < List < Integer >> var_13 = new LinkedList < > ( ) ;
  List < Integer > var_14 = new ArrayList < > ( ) ;
  var_13 . offer ( var_14 ) ;
  while ( ! var_13 . isEmpty ( ) ) {
    int size = var_13 . size ( ) ;
    while ( size > 0 ) {
      List < Integer > var_19 = var_13 . poll ( ) ;
      List < Integer > var_20 = new ArrayList < > ( ) ;
      for ( int var_21 : var_19 ) {
        var_20 . add ( var_3 [ var_21 ] ) ;
      }
      var_5 . add ( var_20 ) ;
      int var_25 = var_19 . size ( ) == 0 ? 0 : var_19 . get ( var_19 . size ( ) - 1 ) + 1 ;
      for ( int var_26 = var_25 ;
      var_26 < var_3 . length ;
      var_26 ++ ) {
        if ( var_26 > var_25 && var_3 [ var_26 ] == var_3 [ var_26 - 1 ] ) {
          continue ;
        }
        var_19 . add ( var_26 ) ;
        var_13 . offer ( new ArrayList < > ( var_19 ) ) ;
        var_19 . remove ( var_19 . size ( ) - 1 ) ;
      }
      size -- ;
    }
  }
  return var_5 ;
}
