title: Comparing two Strings in java and identifying duplicate words
body: <p>I'm trying be able to compare two Strings and identify duplicate words. For example;</p>
  
  <pre><code>String1 = "Hello, my name is John."
  String2 = "Can you tell me your name please?"
  </code></pre>
  
  <p>Comparing String1 and String2 would return the word; "name".</p>
  
  <p>I know it is possible to split these two strings into an array of words, and then iterate over each word of each String in a 2-D array. However this is computationally expensive at O(n^2) and I was wondering if there is a faster way of doing this?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: Changed the example for clarity.</p>