Java TreeSet get tail set

Description

Java TreeSet get tail set


import java.util.SortedSet;
import java.util.TreeSet;

public class Main {
  public static void main(String[] args) {
    TreeSet<String> tSet = new TreeSet<String>();

    tSet.add("1");    
    tSet.add("2");
    tSet.add("3");
    tSet.add("5");
    tSet.add("4");

    SortedSet<String> sortedSet = tSet.tailSet("2");
    System.out.println("Tail Set Contains : " + sortedSet);
  }/*from w  ww  .  j a v a2 s .  c  om*/
}



PreviousNext

Related