import java.util.Iterator;
import java.util.TreeSet;
import javax.management.monitor.StringMonitor;
public class TreeSetAdd {
public static void main(String[] args) {
// creating our TreeSet
TreeSet<String> ts = new TreeSet<>();
// adding element to our set
// insertion order is not maintained here
ts.add("Neha");
ts.add("Nisha");
ts.add("Nishu");
ts.add("Rekha");
ts.add("Madhu");
ts.add("Disha");
ts.add("Tara");
// iterating using Iterator
Iterator<String> itr = ts.iterator();
while (itr.hasNext()) {
System.out.println(itr.next());
}
}
}