<awangdev>345. Reverse Vowels of a String_2.java
public String reverseVowels(String s) {
        if (s == null || s.length() == 0) {
            return s;
        }
        List<Character> vowels = Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');
        List<Character> matches = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            if (vowels.contains(s.charAt(i))) {
                matches.add(s.charAt(i));
            }
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < s.length(); i++) {
            char letter = s.charAt(i);
            if (vowels.contains(letter)) {
                int lastMatchIndex = matches.size() - 1;
                sb.append(matches.get(lastMatchIndex));
                matches.remove(lastMatchIndex);
            } else {
                sb.append(letter);
            }
        }
        return sb.toString();
    }
public String var_0 ( String var_2 ) {
  if ( var_2 == null || var_2 . length ( ) == 0 ) {
    return var_2 ;
  }
  List < Character > var_20 = Arrays . asList ( 'a' , 'e' , 'i' , 'o' , 'u' , 'A' , 'E' , 'I' , 'O' , 'U' ) ;
  List < Character > var_22 = new ArrayList < > ( ) ;
  for ( int var_23 = 0 ;
  var_23 < var_2 . length ( ) ;
  var_23 ++ ) {
    if ( var_20 . contains ( var_2 . charAt ( var_23 ) ) ) {
      var_22 . add ( var_2 . charAt ( var_23 ) ) ;
    }
  }
  StringBuffer var_28 = new StringBuffer ( ) ;
  for ( int var_23 = 0 ;
  var_23 < var_2 . length ( ) ;
  var_23 ++ ) {
    char var_29 = var_2 . charAt ( var_23 ) ;
    if ( var_20 . contains ( var_29 ) ) {
      int var_32 = var_22 . size ( ) - 1 ;
      var_28 . append ( var_22 . get ( var_32 ) ) ;
      var_22 . remove ( var_32 ) ;
    }
    else {
      var_28 . append ( var_29 ) ;
    }
  }
  return var_28 . toString ( ) ;
}
