import java.util.Iterator;
import java.util.TreeSet;
import java.util.Set;
public class TreeSetAddAll {
public static void main(String[] args) {
// creating our TreeSet
Set<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");
ts.add("Tara"); // duplicate element can't be added
// creating another TreeSet
Set<String> ts1 = new TreeSet<>();
ts1.add("Reena");
ts1.add("Sweety");
ts1.add("Sheetal");
// Adding all elements of ts to ts1
System.out.println("After invoking addAll() method");
ts.addAll(ts1);
System.out.println(ts);
}
}