dcsimg
TreeSet.add(object), how does it determine if in list.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shane_Seif
Posted On:   Tuesday, January 15, 2002 12:32 PM

According to the javadoc, the add method only adds elements that are not already added. My question is how is equality determined. I thought, either via the Comparator (for my sort) or the equals method in the objects I am comparing but this doesn't seem to work.

Re: TreeSet.add(object), how does it determine if in list.

Posted By:   Bozidar_Dangubic  
Posted On:   Wednesday, January 16, 2002 06:40 AM

equals() and hashCode() methods. override these two methods if you want to provide your own sorting.
About | Sitemap | Contact