import java.util.Iterator;
import java.util.TreeSet;
import java.util.Set;
public class TreeSetSize {
public static void find_Size(Set<String> set) {
System.out.println("The Size of the given set is = " + set.size());
}
public static void main(String[] args) {
// creating our TreeSet
Set<String> ts = new TreeSet<>();
// adding element to our set
// insertion order is 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<>();
find_Size(ts);
find_Size(ts1);
}
}