NavigableSet: descendingSet() : NavigableSet « java.util « Java by API






NavigableSet: descendingSet()

 


import java.util.NavigableSet;
import java.util.TreeSet;

public class Main {
  public static void main(String[] args) {
    String[] cities = { "A", "B", "C", "D", "E", "F" };
    NavigableSet<String> citiesSet = new TreeSet<String>();
    for (String city : cities)
      citiesSet.add(city);

    for (String city : citiesSet.descendingSet())
      System.out.println("  " + city);
  }
}

   
  








Related examples in the same category

1.NavigableSet: ceiling(T e)
2.NavigableSet: floor(T e)
3.NavigableSet: higher(T e)
4.NavigableSet: lower(T e)