TreeSets, are datastructures that require unique elements and are sorted. This is because treeset is a mix of binary tree(sorted) and a set which cannot contain unique elements.