import java.util.Set;
import java.util.TreeSet;
public class IsEmpty {
public static void main(String[] args) {
Set<String> ts = new TreeSet<String>();
ts.add("mumbai");
ts.add("delhi");
ts.add("kolkata");
ts.add("chandigarh");
ts.add("dehradun");
// print treeset
System.out.println(" ts ="+ts);
System.out.println("Is Empty = "+ts.isEmpty());
Set<String> set = new TreeSet<String>();
System.out.println("Is Empty = "+set.isEmpty());
}
}
Output:
ts =[chandigarh, dehradun, delhi, kolkata, mumbai]
Is Empty = false
Is Empty = true
import java.util.TreeSet;
public class IsEmpty {
public static void main(String[] args) {
Set<String> ts = new TreeSet<String>();
ts.add("mumbai");
ts.add("delhi");
ts.add("kolkata");
ts.add("chandigarh");
ts.add("dehradun");
// print treeset
System.out.println(" ts ="+ts);
System.out.println("Is Empty = "+ts.isEmpty());
Set<String> set = new TreeSet<String>();
System.out.println("Is Empty = "+set.isEmpty());
}
}
Output:
ts =[chandigarh, dehradun, delhi, kolkata, mumbai]
Is Empty = false
Is Empty = true
No comments:
Post a Comment