How to check for duplicate records in .csv using java
<p>I have a CSV file:</p>

<pre><code>10;name1;id1
20;name2;id2
10;name3;id3
</code></pre>

<p>Row for Row i push the data to a method called forward:</p>

<blockquote>
  <p>forward(nr, name, id);</p>
</blockquote>

<p>How can i check the whole csv if "nr" is a duplicate? like in the above example is: 10.</p>

<p>My code now:</p>

<pre><code>while ((line = reader.readLine()) != null) {
    scanner = new Scanner(line);
    scanner.useDelimiter(";");
    while (scanner.hasNext()) {
        String data = scanner.next();
        if (index == 0)
            nr = Integer.parseInt(data);
        else if (index == 1)
            name = data;
        else if (index == 2)
            id = data;
        else
            System.out.println("invalid data::" + data);
        index++;
    }
    index = 0;
    forward(nr, name, id);  
}
</code></pre>

<p>If a duplicate is found, i just want to print it on the screen.</p>