File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .NavigableMap ;
2
+ import java .util .TreeMap ;
3
+
4
+ public class NavigableMap1 {
5
+ //ceilingEntry
6
+ public static void main (String [] args ) throws Exception {
7
+ NavigableMap <Float , Integer > map = new TreeMap <>();
8
+ map .put (1.8f ,11 );
9
+ map .put (2.6f , 9 );
10
+ map .put (3.4f , 78 );
11
+ map .put (4.3f , 5 );
12
+ map .put (5.6f , 1 );
13
+ map .put (6.8f , 3 );
14
+ System .out .println ("Map:" + map );
15
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (1.5f ));// less than 1.8 but it returns 1.8
16
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (1.9f ));// less than 2.6f and greater than 1.8f but it returns 2.6
17
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (4.3f )); // Equal to 4.3f
18
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (3.4f )); // Equal to 3.4f
19
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (6.5f ));// less than 6.8 but it returns 6.8
20
+ System .out .println ("Ceiling Entry:" + map .ceilingEntry (5.6f )); // Equal to 5.6f
21
+ }
22
+
23
+ }
You can’t perform that action at this time.
0 commit comments