Java Collections synchronizedMap() MethodThe synchronizedMap() method of Java Collections class is used to get a synchronized (thread-safe) map backed by the specified map. SyntaxFollowing is the declaration of synchronizedMap() method: Parameter
ReturnsThe synchronizedMap() method returns a synchronized view of the specified Map. ExceptionsNA Example 1Test it NowOutput: Synchronized map is :{1=Rahul, 3=Mohan, 4=Karan} Example 2Test it NowOutput: 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 3Test it NowOutput: 10000 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