Javatpoint Logo
Javatpoint Logo

Java Collections synchronizedNavigableMap() Method

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

Test it Now

Output:

Synchronized navigable map is :{1=Google, 2=Facebook, 3=Java, 4=JavaTpoint}

Example 2

Test it Now

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

Test it Now

Output:

10





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA