76
Java ConcurrentHashMap keySet() Method
The 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.
Syntax
Parameter
No parameter is passed.
Returns
the set view
Throws
No Exception is thrown.
Example 1
Output:
Map : {20=php, 10=Java, 11=.net, 12=C, 30=C++} keySet : [20, 10, 11, 12, 30]
Example 2
Output:
Using KeySet : [A, B, C, D, E] enumeration of keys are: A B C D E
Next TopicJava ConcurrentHashMap