Javatpoint Logo
Javatpoint Logo

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]





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA