Java tutorial
import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args) { TreeSet<String> ss = new TreeSet<String>(); String[] fruits = { "apples", "pears", "grapes", "bananas", "kiwis" }; for (String fruit : fruits) { ss.add(fruit); } for (String s : ss) { System.out.print(s); } } }