Java ConcurrentHashMap keySet() MethodThe keySet() method of ConcurrentHashMap class returns a Set view of the keys contained in this map. The set is stacked by the map, so changes to the map are reflected in the set, and vice-versa. SyntaxParameterNo parameter is passed. Returnsthe set view ThrowsNo Exception is thrown. Example 1Test it NowOutput: Map : {20=php, 10=Java, 11=.net, 12=C, 30=C++} keySet : [20, 10, 11, 12, 30] Example 2Test it NowOutput: Using KeySet : [A, B, C, D, E] enumeration of keys are: A B C D E
Next TopicJava ConcurrentHashMap
|