![]() |
VOOZH | about |
NavigableMap is used for convenient navigation methods like lowerKey, floorKey, ceilingKey, and higherKey, along with this popular navigation method. It will take key-value pair as input
We can create a navigable map by using the following syntax:
NavigableMap<key_datatype, value_datatype> data= new TreeMap<key_datatype, value_datatype>();
where
synchronizedNavigableMap() Method will return the synchronized, which is a thread-safe navigable map backed by the specified navigable map.
Syntax:
public static <Key,Value> NavigableMap<K,V> synchronizedNavigableMap(NavigableMap<Key,Value> data)
where data is the navigable map which will be wrapped into a synchronized navigable map.
Return Type: The synchronizedNavigableMap() method returns a synchronized view of the specified Navigable Map.
Example 1: Create a synchronized navigable map using string elements
{1=java, 2=python, 3=php, 4=html/js}Example 2:
{1=34, 2=45, 3=74, 4=41, 5=4, 6=40}