title: Remove duplicates from a list of String Array
body: <p>I know there's a lot of subject about "removing duplicates of a list". I liked the solution with  <code>HashSet</code>. However, what I have is an list of String[], and it won't work with it. Probably because <code>stringArray1.equals(stringArray2)</code> will return false even if the two <code>stringArray</code> are the same; to compare string Array, we have to use Arrays.equals, which is not the case with <code>HashSet</code>. </p>
  
  <p>So i have an userList of <code>String[]</code> users with only 2 strings in it: username, and userID. Since both are linked (there's only one userID per username), it would be enough for me to compare only one of those strings. </p>
  
  <p>What I need is a fast way to remove duplicates from the list. </p>
  
  <p>I thought about something like this: </p>
  
  <pre><code>List&lt;String&gt; userNamesList = new ArrayList&lt;String&gt;();
  List&lt;String[]&gt; userListWithoutDuplicates = new ArrayList&lt;String[]&gt;();
  for(String[] user : userList){
      if(!userNamesList.contains(user[0])){
          userNamesList.add(user[0]);
          userListWithoutDuplicates.add(user);
      }
  }
  </code></pre>
  
  <p>However, this need two new List and a loop (I'm pretty sure any other solution would need this loop, still).</p>
  
  <p>I'm wondering if there's not a better solution. I thought something like that should already be implemented somewhere. </p>
  
  <p>EDIT: I got my array from an sql query. In fact, i have a DB and some users. One user will search for others users responding to certain conditions in DB, DB send back a list of String[] {username, userID} to this user. 
  So i already have an user class, which contains far more than only username and ID. I have one instance of this class per connected user, but the DB can't access those instances, so she can't send it.
  I thought a String array was an easy solution. I didn't thought that, in certain cases, an user can be referenced more than one time in DB and so selected more than one time. That's why i got duplicates in my list. </p>