Skip to content

Commit 5c2e84a

Browse files
Add files via upload
1 parent 0ab0420 commit 5c2e84a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

NavigableMap12.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.NavigableMap;
2+
import java.util.TreeMap;
3+
public class NavigableMap12 {
4+
// lowerEntry
5+
public static void main(String[] args) throws Exception {
6+
NavigableMap<Float, Integer> map = new TreeMap<>();
7+
map.put(1.8f,11 );
8+
map.put(2.6f, 9);
9+
map.put(3.4f, 78);
10+
map.put(4.3f, 5);
11+
map.put(5.6f, 1);
12+
map.put(6.8f, 3);
13+
System.out.println("Map:" + map);
14+
System.out.println("lowerEntry:" + map.lowerEntry(3.0f));
15+
// i.e. if less than 3.4f then it returns Key:2.6f and its Value:9 (LowerEntry)
16+
System.out.println("lowerEntry:" + map.lowerEntry(4.3f));
17+
// i.e. if equal to 4.3f then it returns Key:3.4f and its Value:78 (LowerEntry)
18+
System.out.println("lowerEntry:" + map.lowerEntry(1.8f));
19+
// i.e. if equal to 1.8f then it returns null -- No LowerEntry
20+
21+
}
22+
23+
}

0 commit comments

Comments
 (0)