If sizes are same
if ( list . get ( i ) . length ( ) != s . length ( ) ) { continue ; } boolean diff = false ; for ( int j = 0 ; j < ( int ) list . get ( i ) . length ( ) ; j ++ ) { if ( list . get ( i ) . charAt ( j ) != s . charAt ( j ) ) {