if you remove something from the subset, it's gone.
if you try to add something to the subtree, it must "fit" within your view of the tree.
And if you add something to the original view, the subset will be altered, too.
import java.util.Arrays; import java.util.TreeSet; public class MainClass { public static void main(String args[]) throws Exception { String elements[] = { "A", "C", "D", "G", "F" }; TreeSet set = new TreeSet(Arrays.asList(elements)); System.out.println(set.subSet("C", "F")); } }
[C, D]