Compare two lists and get unique list (example.txt) java
<p>I found here a good code that will help me to finish a thing to do.
But what I need:
I have two lists, one list is example1.txt and sencond list is example2.txt I need to get similar and different. I dont know where to set the c://example1.txt and c://example2.txt</p>

<p>for example: Arrays.asList(c://example1.txt);</p>

<pre><code>import java.util.Collection;
import java.util.HashSet;
import java.util.Arrays;

class Repeated {
      public static void main( String  [] args ) {

          Collection&lt;String&gt; listOne = Arrays.asList("1","2","3");

          Collection&lt;String&gt; listTwo = Arrays.asList("1","2","2");

          Collection&lt;String&gt; similar = new HashSet&lt;String&gt;( listOne );
          Collection&lt;String&gt; different = new HashSet&lt;String&gt;();
          different.addAll( listOne );
          different.addAll( listTwo );

          similar.retainAll( listTwo );
          different.removeAll( similar );

          System.out.printf("One:%s%nTwo:%s%nSimilar:%s%nDifferent:%s%n", listOne, listTwo, similar, different);
      }
}
</code></pre>
