Hashset and TreeSet(Set Interface) in java tutorial-32 (2020) latest

Опубликовано: 03 Ноябрь 2024
на канале: Pushpendra Kumar
286
5

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.