title: Create an ArrayList of unique values
body: <p>I have an <code>ArrayList</code> with values taken from a file (many lines, this is just an extract):</p>
  
  <pre class="lang-none prettyprint-override"><code>20/03/2013 23:31:46 6870    6810    6800    6720    6860    6670    6700    6650    6750    6830    34864   34272
  20/03/2013 23:31:46 6910    6780    6800    6720    6860    6680    6620    6690    6760    6790    35072   34496
  </code></pre>
  
  <p>Where the first two values per line are strings that contain data and are stored in a single element.</p>
  
  <p>What I want to do is compare the string data elements and delete, for example, the second one and all the elements referred to in that line.</p>
  
  <p>For now, I've used a <code>for</code> loop that compares the string every 13 elements (in order to compare only data strings).</p>
  
  <p>My question: can I implement other better solutions?</p>
  
  <p>This is my code:</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.List;
  import java.util.ArrayList;
  import java.io.*;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  
  public class Main {
      public static void main(String[] args) throws Exception{
  
          //The input file
          Scanner s = new Scanner(new File("prova.txt"));
  
          //Saving each element of the input file in an arraylist 
          ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
          while (s.hasNext()){
              list.add(s.next());
          }
          s.close();
  
          //Arraylist to save modified values
          ArrayList&lt;String&gt; ds = new ArrayList&lt;String&gt;();
  
          //
          int i;
          for(i=0; i&lt;=list.size()-13; i=i+14){
  
              //combining the first to values to obtain data  
              String str = list.get(i)+" "+list.get(i+1);
              ds.add(str);
              //add all the other values to arraylist ds
              int j;
              for(j=2; j&lt;14; j++){
                  ds.add(list.get(i+j));
              }
  
              //comparing data values
              int k;  
              for(k=0; k&lt;=ds.size()-12; k=k+13){
                  ds.get(k); //first data string element  
                  //Comparing with other strings and delete
                  //TODO  
              }
          }
      }
  }
  </code></pre>