Java / Map and its implementations
Explain NavigableMap in Java collection.
NavigableMap Map was added in Java 1.6 that provides navigation capability to Map data structure. It provides methods such as lowerKey() to get keys which is less than specified key, floorKey() to retrieve keys which is less than or equal to specified key, ceilingKey() to get keys which is greater than or equal to specified key and higherKey() to return keys which is greater specified key from a Map.
Similarly navigable methods lowerEntry(), floorEntry(), ceilingEntry() and higherEntry() are available to retrieve map entries.
In addition to the navigation methods, it also enables creating sub-Map, for example, creating a Map from entries of an existing Map using tailMap, headMap and subMap. headMap() method returns a NavigableMap whose keys are less than specified, tailMap() returns a NavigableMap whose keys are greater than the specified and subMap() gives a NavigableMap between a range, specified by toKey to fromKey.
More Related questions...