treeset remove 28 29 method in java

Solutions on MaxInterview for treeset remove 28 29 method in java by the best coders in the world

showing results for - "treeset remove 28 29 method in java"
Angelo
03 Mar 2016
1import java.util.TreeSet;
2public class TreeSetRemoveMethodExample
3{
4   public static void main(String[] args)
5   {
6      TreeSet<String> ts = new TreeSet<String>();
7      ts.add("orange");
8      ts.add("green");
9      ts.add("blue");
10      ts.add("red");
11      ts.add("violet");
12      ts.add("yellow");
13      System.out.println("Given TreeSet: " + ts);
14      // remove elements using remove() method
15      ts.remove("blue");
16      ts.remove("violet");
17      ts.remove("red");
18      // print TreeSet after removal
19      System.out.println("New TreeSet: " + ts);
20   }
21}
22
23
24