initialize the TreeSet with comparator