Hashtable ceiling Example
Hashtable class ceiling example. This example shows you how to use ceiling method.
Hashtable class ceiling example.public Object ceiling(Object) Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
Here is the code
/**
* @ # Ceiling.java
* A class repersenting use to ceiling method
* of TreeSet class in java.util package
* version 23 May 2008
* author Rose India
*/
import java.util.*;
public class Ceiling {
public static void main(String args[]) {
TreeSet treeset = new TreeSet();
// Add the elements to the set and display it:
treeset.add(1);
treeset.add(4);
treeset.add(5);
treeset.add(2);
System.out.println("treeset = " + treeset);
// Find the least element in this set greater than
System.out.println(treeset.ceiling(3));
}
} |
|