title: Implement basic autocomplete in Java
body: <p>Given an array of words and phrases, given a key, return :</p>
  
  <ul>
  <li>All words that start with the key</li>
  <li>All phrases that contain a word that start with key</li>
  </ul>
  
  <p>For example:</p>
  
  <p><code>wordbank = ["bang", "base", "bore", "band", "This is a baffling problem];</code></p>
  
  <p><code>key = "ba";</code></p>
  
  <p><code>autocomplete(wordbank, key)</code> should return <code>["bang", "base", "band", "This is a baffling problem]</code></p>
  
  <p>I used a Trie to do it, but just wondering if <a href="http://www.tutorialspoint.com/compile_java8_online.php?PID=0Bw_CjBb95KQMODkzSHljY1VOY2M" rel="nofollow noreferrer">this is a good solution?</a></p>
  
  <p>To run, just enter <code>java Test</code> in the terminal. The test case in the link is not the same as the example here.</p>