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


java.util.TreeSet.floor(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(12);
      treeadd.add(11);
      treeadd.add(16);
      treeadd.add(15);

      // getting the floor value for 13
      System.out.println("Floor value for 13: "+treeadd.floor(13));   
   }    
}