86
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
Output:
Synchronized Sorted set is :[Facebook, Instagram, Twitter, Whatsapp]
Example 2
Output:
Set after Synchronized sorted set- 101 102 103 104 105
Example 3
Output:
1000
Next TopicJava Collections Class