Check out example codes for "TreeSet subSet() method in java". It will help you in understanding the concepts better.

Code Example 1

import java.util.Iterator;
import java.util.TreeSet;
public class TreeSetSubSetMethodExample
{
   public static void main(String[] args)
   {
      TreeSet<Integer> ts = new TreeSet<Integer>();
      TreeSet<Integer> sub = new TreeSet<Integer>();
      ts.add(11);
      ts.add(22);
      ts.add(33);
      ts.add(44);
      ts.add(55);
      ts.add(66);
      ts.add(77);
      ts.add(88);
      // creating subset
      sub = (TreeSet)ts.subSet(22, true, 77, true);
      // create iterator
      Iterator<Integer> iterate = sub.iterator();
      System.out.println("TreeSet subset: ");
      while(iterate.hasNext())
      {
         System.out.println(iterate.next() + " ");
      }
   }
}

Learn ReactJs, React Native from akashmittal.com