HashSet and TreeSet: Set interface class hierarchy in Collections framework HashSet and TreeSet are two important classes. Hashset offers much faster performance than TreeSets. Hashsets provide constant time access, while the TreeSets have logarithmic time access for most of the operations like add,remove and contains etc. HashSet does not offer ordering guarantee, but TreeSets offers guarantee of ordering. However, duplicated elements are not allowed in any of the set.