title: Check if the dictionary contains a certain word
body: <p>I've come up with the following problem: suppose the words are being added into the dictionary that is based on some data strucure. For example, the following words are added:</p>
  
  <pre><code>"bob", "dad", "bad"
  </code></pre>
  
  <p>And suppose I want to check if a certain word is in the dictionary by implementing the method:</p>
  
  <pre><code>public boolean checkWord(String word)
  </code></pre>
  
  <p>However, the character <code>'.'</code> also represents some letter so if, for example:</p>
  
  <pre><code>checkWord(".ob")
  </code></pre>
  
  <p>then the result is <code>true</code> (as '.' can be substituted or represented by <code>b</code> and would be <code>bob</code>). Or another example is:</p>
  
  <pre><code>checkWord("..d") 
  </code></pre>
  
  <p>which also return <code>true</code> (because of <code>"dad"</code>). </p>
  
  <p>I need help only with how to check if the words match. Suppose the data structure is <code>ArrayList</code> and dictionary is represented as <code>myList</code>. My code is giving always <code>true</code> for whatever <code>String</code> I pass. Please could smb please help me out? I just want to know how to return true if a dictionary contains <code>"bob"</code> and a passing check word is <code>".ob"</code>, then how can I omit the character <code>'.'</code> and check other characters? Thanks in advance!</p>
  
  <pre><code>public boolean checkWord(String word){
     boolean result = false;
     if(myList.contains(word)){
         return true; 
     }
     else{
         for(int i = 0; i &lt; myList.size(); i++){
            if(myList.get(i).length() == word.length()){
               for(int j = 0; j &lt; word.length(); j++){
                   if(word.charAt(j) == myList.get(i).charAt(j)){
                      result = true;
                   }
               }
            }
         }
     }
  return result;
  } 
  </code></pre>