java treeset.clone code example
Example: TreeSet clone() method in java
import java.util.TreeSet;
public class TreeSetCloneMethodExample
{
public static void main(String[] args)
{
TreeSet<String> ts = new TreeSet<String>();
ts.add("green");
ts.add("blue");
ts.add("yellow");
ts.add("red");
ts.add("violet");
ts.add("orange");
System.out.println("TreeSet: " + ts);
TreeSet<String> treeCloned = new TreeSet<String>();
treeCloned = (TreeSet)ts.clone();
System.out.println("cloned TreeSet: " + treeCloned);
}
}