synchronizedNavigableMap()
Java Collections synchronizedNavigableMap() Method
Last Updated : 17 Mar 2025
The synchronizedNavigableMap() method of Java Collections class is used to get a synchronized (thread-safe) navigable map backed by the specified navigable map.
Syntax
Following is the declaration of synchronizedNavigableMap() method:
Parameter
| Parameter | Description | Required/Optional |
|---|---|---|
| m | It is the navigable map which will be wrapped in a synchronized navigable map. | Required |
Returns
The synchronizedNavigableMap() method returns a synchronized view of the specified Navigable Map.
Exceptions
NA
Compatibility Version
Java 1.8 and above
Example 1
Output:
Synchronized navigable map is :{1=Google, 2=Facebook, 3=Java, 4=TpointTech}
Example 2
Output:
Map before Synchronized map: {1=1001, 2=1002, 3=1003, 4=1004, 5=1005}
Synchronized map after remove(4, 1004):{1=1001, 2=1002, 3=1003, 5=1005}
Example 3
Output:
10
Next TopicJava Collections Class