<awangdev>Word Pattern_1.java
public boolean wordPattern(String pattern, String str) {
        if (pattern == null || pattern.length() == 0 || str == null || str.length() == 0) {
            return false;
        }
        
        String[] strArr = str.split(" ");
        if (pattern.length() != strArr.length) {
            return false;
        }
        HashMap<Character, String> map = new HashMap<Character, String>();        
        
        for (int i = 0; i < pattern.length(); i++) {
            char c = pattern.charAt(i);
            String s = strArr[i];
            if (!map.containsKey(c)) {
                if (map.containsValue(s)) {
                    return false;
                }
                map.put(c, s);
            } else if (!map.get(c).equals(s)) {
                return false;
            }
        }
        return true;
    }
public boolean var_0 ( String var_2 , String var_3 ) {
  if ( var_2 == null || var_2 . length ( ) == 0 || var_3 == null || var_3 . length ( ) == 0 ) {
    return false ;
  }
  String [ ] var_9 = var_3 . split ( " " ) ;
  if ( var_2 . length ( ) != var_9 . length ) {
    return false ;
  }
  HashMap < Character , String > var_12 = new HashMap < Character , String > ( ) ;
  for ( int var_13 = 0 ;
  var_13 < var_2 . length ( ) ;
  var_13 ++ ) {
    char var_15 = var_2 . charAt ( var_13 ) ;
    String var_16 = var_9 [ var_13 ] ;
    if ( ! var_12 . containsKey ( var_15 ) ) {
      if ( var_12 . containsValue ( var_16 ) ) {
        return false ;
      }
      var_12 . put ( var_15 , var_16 ) ;
    }
    else if ( ! var_12 . get ( var_15 ) . equals ( var_16 ) ) {
      return false ;
    }
  }
  return true ;
}
