Java Collections synchronizedSet() MethodThe synchronizedSet() method of Java Collections class is used to get a synchronized (thread-safe) set backed by the specified set. SyntaxFollowing is the declaration of synchronizedSet() method: Parameter
ReturnsThe synchronizedSet() method returns a synchronized view of the specified Set. ExceptionsNA Example 1Test it NowOutput: Synchronized set is :[Twitter, Instagram, Facebook, Whatsapp] Example 2Test it NowOutput: Set before Synchronized set: [101, 102, 103, 104, 105] Set after Synchronized set- 101 102 103 104 105 Example 3Test it NowOutput: initial set size: 0 1000 Next TopicJava Collections Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India