Java TreeSet.higher(E e)
Syntax
TreeSet.higher(E e) has the following syntax.
public E higher(E e)
Example
In the following code shows how to use TreeSet.higher(E e) method.
import java.util.TreeSet;
//from w w w . j a v a 2s . c o m
public class Main {
public static void main(String[] args) {
TreeSet <Integer> treeadd = new TreeSet<Integer> ();
treeadd.add(12);
treeadd.add(11);
treeadd.add(16);
treeadd.add(15);
// getting the higher value for 13
System.out.println("Higher value of 13: "+treeadd.higher(13));
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »