81
Java ConcurrentHashMap values() Method
The values() method of ConcurrentHashMap class returns a Collection view of the values contained in this map. The collection is stacked by the map, so changes to the map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from this map, via the Iterator
Syntax
Parameter
No parameter is passed.
Returns
the collection view
Throws
No exception is thrown.
Example 1
Output:
mymap2 :[101, 102, 103] mymap :[Java, angular, JavaScript] comparing mymap and mymap2 :false
Example 2
Output:
HashMap : [100, 200, 300, 400]
Next TopicJava ConcurrentHashMap