Javatpoint Logo
Javatpoint Logo

Java Collections synchronizedSortedSet() Method

The synchronizedSortedSet() method of Java Collections class is used to get a synchronized (thread-safe) sorted set backed by the specified sorted set.

Syntax

Following is the declaration of synchronizedSortedSet() method:

Parameter

Parameter Description Required/Optional
s It is the sorted set which will be wrapped in a synchronized sorted set. Required

Returns

The synchronizedSortedSet() method returns a synchronized view of the specified Sorted Set.

Exceptions

NA

Example 1

Test it Now

Output:

Synchronized Sorted set is :[Facebook, Instagram, Twitter, Whatsapp]

Example 2

Test it Now

Output:

Set after Synchronized sorted set-
101
102
103
104
105

Example 3

Test it Now

Output:

1000





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA