title: Count number of strings that match in two arrays in Java
body: <p>Given two Strings arrays, a and b, each in alphabetical order, I want to return the count of the number of strings that match in both arrays.</p>
  
  <pre><code>public int countMatch(String[] a, String[] b) {
  
  }
  </code></pre>
  
  <p>My aim is to be able to call the method as follows;</p>
  
  <pre><code>countMatch({"apple", "banana", "xylophone"}, {"banana", "carrot", "dog", "xray", "xylophone"});
  </code></pre>
  
  <p>which should return the int value 2, as there are two strings that match each array ("banana" and "xylophone").</p>
  
  <p>It may be important to note that the arrays will both always be in alphabetical order, if that helps with the solution.</p>