Is there any way to loop in NavigableMap in Java? I want to access all of item in NavigableMap.
The NavigableMap interface is a member of the Java Collection Framework. It belongs to java. util package and It is an extension of SortedMap which provides convenient navigation methods like lowerKey, floorKey, ceilingKey and higherKey, and along with this popular navigation method.
The same way you would loop any collection, with an iterator or for-each loop.
NavigableMap<K, V> map = ...
for(K key: map.keySet()) // iterate keys.
for(V value: map.values()) // iterate values.
for(Entry<K, V> entry: map.entrySet()) // iterate key/value entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With