posted 13 years ago
You are using a TreeSet. A TreeSet instance performs all element comparisons using its compareTo (or compare) method, so two elements that are deemed equal by this method are, from the standpoint of the set, equal. You cannot add two equals objects in a Set. If all your objects compareTo method returns 0, they are all equal, so only only object can be added in the set : the first one.