Which java.util.Set realizations sorts the elements by their natural order (or on Comparator basis).?
TreeSet sorts the elements (it implements SortedSet). LinkedHashSet allows you to control the order of the addition of elements, but does not sort them.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes