Read file and count same entries in Java
<p>I need some advice. I know how to solve this problem clumsily, but I want to do it the <em>right</em> way, as I need to impress someone for a potential internship.</p>

<p>I have a textfile, for example:</p>

<pre><code>[XXX622] [YYY]  [LLL]   [E77700]  [NNN]  [6JL99NNN] [HH66]  [0770LLL]  [R88] [VVV]
[B177HQ] [8RR22]   [PPP]  [GGG]  [CCXXXGG]   [8IIXX0] [3KCC]   [00222]
[222] [OO] [OO] [OO] [99]   [555444]   [33]
</code></pre>

<p>I need to read the entries and then do processes with them, for example sort alphabetically. </p>

<p>The process I don't know how to do is counting how many similar entries are in each line.</p>

<p>If I read the entries into a string array and pass the array to the counting method, then how should I make it so the method knows from which line each entry is? Should I create a 2D array and insert the linenumber along with the entry into it as a string?</p>

<p>Thanks in advance!</p>
