Which java.util.Set realizations sorts the elements by their natural order (or on Comparator basis).?
Explanation
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
Cosmo
Sign Up Now
or Subscribe for future quizzes