Example of ceiling method in java navigableSet method.

Example of ceiling method in java navigableSet method.


Posted in : Java Posted on : December 6, 2010 at 6:12 PM Comments : [ 0 ]

Example of ceiling method in java navigableSet method.

Example of ceiling method in java navigableSet method.

Here, you will see the implementation of ceiling(Element e ) method in java. It returns least element in this set. That is greater than or equal to the current element.

Code:

ForwardTraverseNavigableSet.java

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

public class NavigableCeilingMethod{
public static void main(String[] args) {
	Integer[] integers = { 2, 3, 4, 5, 6 };
	NavigableSet obNavigableSet = new TreeSet();
	System.out.println("Display least elemenmt(greater than or equal) :");
	for (Integer city : integers)
	obNavigableSet.add(city);
	System.out.println(obNavigableSet.ceiling(1));
    }
}	
Output:
Forward traversing of navigableSet.
2
3
4
5
6

Download this code.
Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics