search elements in an array in java
<p>I'm wondering what kind method should I use to search the elements in an array and what data structure to store the return value</p>

<p>For example a txt file contains following</p>

<blockquote>
  <p>123 Name  line  Moon night table<br />
  124 Laugh Cry Dog<br />
  123 quote line make pet table<br />
  127 line array hello table<br /></p>
</blockquote>

<p>and the search elements are line+table 
I read every line as an string and then spilt by space</p>

<p>the output should like this</p>

<blockquote>
  <p>123 2 (ID 123 occurs twice that contains the search elements)<br />
  127 1<br /></p>
</blockquote>

<p>I want some suggestions of what kind method to search the elements in the array and what kind data structure to store the return value (the ID and the number of occurs. I'm thinking hashmap)</p>
