sort elements with sortedset

Java
SortedSet<String> sets = new TreeSet<>(); 
Source

Also in Java: