Difference between HashSet, LinkedHashSet and TreeSet

HashSetLinkedHashSetTreeSet
Underlying Data StructureHashTableHashTable and LinkedListBalanced Tree
Duplicates ObjectsNot AllowedNot AllowedNot Allowed but can be customized
SortingOrderNANAApplicable
Heterogeneous ObjectsAllowedAllowedNot Allowed By Default
Null ObjectAllowedAllowedNot Allowed

Leave a Comment