java.util.TreeSet.lower(E e) 方法示例


java.util.TreeSet.lower(E e) 方法示例

package com.codingdict;

import java.util.TreeSet;

public class TreeSetDemo {
   public static void main(String[] args) {

      // creating a TreeSet
      TreeSet <Integer>treeadd = new TreeSet<Integer>();

      // adding in the tree set
      treeadd.add(1);
      treeadd.add(13);
      treeadd.add(17);
      treeadd.add(2);

      // displaying the greatest element < 17
      System.out.println("Greatest element less than 17 is: "+treeadd.lower(17));    
   }     
}