I have a quick question about TreeSet collections and hashCode methods. I have a TreeSet and I\'m adding objects to it, before I add an object, I check to see i
You don't need to checked if it is contained, because the insert() basically does the same operation (i.e. searching the proper position) on its way to the insertion point. If the object can't be inserted (i.e., the object is already contained), insert returns false.