Home » Java ConcurrentHashMap values() Method

Java ConcurrentHashMap values() Method

by Online Tutorials Library

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

Test it Now

Output:

mymap2 :[101, 102, 103]   mymap :[Java, angular, JavaScript]  comparing mymap and mymap2 :false  

Example 2

Test it Now

Output:

HashMap :   [100, 200, 300, 400]  

You may also like