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 }; NavigableSetOutput: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)); } }
Forward traversing of navigableSet. 2 3 4 5 6 |
Download this code.
[ 0 ] Comments