<awangdev>Letter Combinations of a Phone Number_3.java
public List<String> letterCombinations(String digits) {
        List<String> rst = new ArrayList<String>();
        if (digits == null || digits.length() == 0) {
            return rst;
        }
        HashMap<Integer, String> map = new HashMap<Integer, String>();
        map.put(2, "abc");map.put(3, "def");
        map.put(4, "ghi");map.put(5, "jkl");map.put(6, "mno");
        map.put(7, "pqrs");map.put(8,"tuv");map.put(9,"wxyz");
        
        Queue<String> queue = new LinkedList<String>();
        
        int index = 0;
        int digit = Integer.parseInt(digits.substring(index, index + 1));
        String keys = map.get(digit);
        index++;
        
        for (int i = 0; i < keys.length(); i++) {
            queue.offer(keys.substring(i,i+1));
        }
        int size = queue.size();
        
        while (index < digits.length() && !queue.isEmpty()) {
            String str = queue.poll();
            digit = Integer.parseInt(digits.substring(index, index + 1));
            keys = map.get(digit);
            for (int i = 0; i < keys.length(); i++) {
                queue.offer(str + keys.substring(i,i+1));
            }
            size--;
            if (size == 0 && index < digits.length() - 1) {
                index++;
                size = queue.size();
            }
        }
        
        while (!queue.isEmpty()) {
            rst.add(queue.poll());
        }
        
        return rst;
    }
public List < String > var_1 ( String var_2 ) {
  List < String > var_5 = new ArrayList < String > ( ) ;
  if ( var_2 == null || var_2 . length ( ) == 0 ) {
    return var_5 ;
  }
  HashMap < Integer , String > var_11 = new HashMap < Integer , String > ( ) ;
  var_11 . put ( 2 , "abc" ) ;
  var_11 . put ( 3 , "def" ) ;
  var_11 . put ( 4 , "ghi" ) ;
  var_11 . put ( 5 , "jkl" ) ;
  var_11 . put ( 6 , "mno" ) ;
  var_11 . put ( 7 , "pqrs" ) ;
  var_11 . put ( 8 , "tuv" ) ;
  var_11 . put ( 9 , "wxyz" ) ;
  Queue < String > var_31 = new LinkedList < String > ( ) ;
  int var_32 = 0 ;
  int var_36 = Integer . parseInt ( var_2 . substring ( var_32 , var_32 + 1 ) ) ;
  String var_38 = var_11 . get ( var_36 ) ;
  var_32 ++ ;
  for ( int var_39 = 0 ;
  var_39 < var_38 . length ( ) ;
  var_39 ++ ) {
    var_31 . offer ( var_38 . substring ( var_39 , var_39 + 1 ) ) ;
  }
  int size = var_31 . size ( ) ;
  while ( var_32 < var_2 . length ( ) && ! var_31 . isEmpty ( ) ) {
    String var_44 = var_31 . poll ( ) ;
    var_36 = Integer . parseInt ( var_2 . substring ( var_32 , var_32 + 1 ) ) ;
    var_38 = var_11 . get ( var_36 ) ;
    for ( int var_39 = 0 ;
    var_39 < var_38 . length ( ) ;
    var_39 ++ ) {
      var_31 . offer ( var_44 + var_38 . substring ( var_39 , var_39 + 1 ) ) ;
    }
    size -- ;
    if ( size == 0 && var_32 < var_2 . length ( ) - 1 ) {
      var_32 ++ ;
      size = var_31 . size ( ) ;
    }
  }
  while ( ! var_31 . isEmpty ( ) ) {
    var_5 . add ( var_31 . poll ( ) ) ;
  }
  return var_5 ;
}
