Hi all
when i run the following code

TreeSet<Integer> s = new TreeSet<Integer>();
 TreeSet<Integer> subs = new TreeSet<Integer>();
 for(int i = 606; i < 613; i++)
 if(i%2 == 0) s.add(i);
 subs = (TreeSet)s.subSet(606,true, 630,true); 
 System.out.println(s + " " + subs);

the O/P is
[606, 608, 610, 612, 629, 630] [606, 608, 610, 612, 629, 630]
my doubts are
1) what is mean by those true statement here ?
2) element 629 and 630 i added after subset operation still it shows in the output

pls help me
thanks in advance

Edited 5 Years Ago by anand01: n/a

Oh yes, the subset is a "backed" copy which means that it reflects any changes you make in the original set. Similarly any changes you make in the subset will be reflected in the original. Be careful added members to the subset - the original limits (606 to 630 inclusive) still apply. If you try to add a value outside this range the subset will throw an exception.

This question has already been answered. Start a new discussion instead.