I am checking how TreeSet checks for duplicate elements and have the following code
import java.util.*; public class TreeDemo{ public static void main(
a comparator return < 0, 0 or > 0... So equals is implemented by compareTo returning 0. Thus
if (node1.compareTo(node2) == 0)
then the node is already in the set