<awangdev>243. Shortest Word Distance_1.java
public int shortestDistance(String[] words, String word1, String word2) {
        Integer p1 = null, p2 = null;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < words.length; i++) {
            if (words[i].equals(word1)) p1 = i;
            if (words[i].equals(word2)) p2 = i;
            if (p1 != null && p2 != null) min = Math.min(min, Math.abs(p1 - p2));
        }
        return min;
    }
public int sample_funcname ( String [ ] var_1 , String var_2 , String var_3 ) {
  Integer var_6 = null , var_7 = null ;
  int min = Integer . MAX_VALUE ;
  for ( int var_11 = 0 ;
  var_11 < var_1 . length ;
  var_11 ++ ) {
    if ( var_1 [ var_11 ] . equals ( var_2 ) ) var_6 = var_11 ;
    if ( var_1 [ var_11 ] . equals ( var_3 ) ) var_7 = var_11 ;
    if ( var_6 != null && var_7 != null ) min = Math . min ( min , Math . abs ( var_6 - var_7 ) ) ;
  }
  return min ;
}
