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); 
 s.add(629); 
 s.add(630); 
 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

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.

thanks Paul Norris,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.