title: No duplicate reading from a file
body: <p>I have a text file and in it there is a list of city:</p>
  
  <ol>
  <li>New York</li>
  <li>Los Angeles</li>
  <li>Chicago</li>
  <li>York</li>
  <li>Toronto
  ecc...</li>
  </ol>
  
  <p>I would load every line on a list in java without duplicate.I tried to load it but when I print the list I have duplicate.</p>
  
  <pre><code>private Set&lt;Comune&gt; comunilist;
  
  public ReteStradale(){
      comunilist=new HashSet&lt;Comune&gt;(); 
  }
  
  private void loadComuni(String sname){
  
      try{
  
          BufferedReader reader=new BufferedReader(new FileReader(sname));
  
          String id_street=reader.readLine();
  
          while(id_street!=null){
  
              int length=Integer.parseInt(reader.readLine());
              String comune_par=reader.readLine();
              String comune_arr=reader.readLine();
  
              Comune com=new Comune(comune_par);
  
                  comunilist.add(com); 
  
              id_street=reader.readLine();    
          }
  
      }
      catch(FileNotFoundException ffe){
          System.err.println("Error: the file does not exist!");
      }
      catch(IOException ioe){
          ioe.printStackTrace();
      }
  }
  </code></pre>
  
  <p>here is my code.please don't considerer the name of element but the code</p>