TreeSet.isEmpty() has the following syntax.
public boolean isEmpty()
In the following code shows how to use TreeSet.isEmpty() method.
/*from w ww. ja v a 2 s.c om*/ import java.util.TreeSet; public class Main { public static void main(String[] args) { TreeSet <Integer> treeadd = new TreeSet<Integer> (); System.out.println(treeadd.isEmpty()); treeadd.add(2); System.out.println(treeadd.isEmpty()); } }
The code above generates the following result.