title: Java TreeSet not storing unique values
body: <p>I have a TreeSet of objects called Artifacts.  I have overridden the equals and hash code methods in the object like so:</p>
  
  <pre><code> @Override
  public int hashCode() {
      return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
          // if deriving: appendSuper(super.hashCode()).
          append(artifactId).
          toHashCode();
  }
  
  @Override
  public boolean equals(Object arg0) {
  
      Artifact obj=(Artifact)arg0;
  
      if(this.getArtifactId().equalsIgnoreCase(obj.getArtifactId()))
      {
  
              return true;
      }
  
     return false;
  }
  </code></pre>
  
  <p>I have put prints in the equals method and it is never called.  I have instantiated the TreeSet with a comparator which looks like: </p>
  
  <pre><code> TreeSet&lt;Artifact&gt; syncedList = new TreeSet&lt;Artifact&gt;(new ArtifactComparator());
  </code></pre>
  
  <p>I have read that the TreeSet establishes it's uniqueness based on the equals override.  </p>
  
  <p>I see multiple objects with the same ArtifactId in the TreeSet which is not unique like I need.</p>
  
  <p>Is something missing in my equals and hash code methods?</p>