values(): This method is available in java.util.IdentityHashMap class of Java.
Syntax:
Collection<V> java.util.IdentityHashMap.values()
This method returns a Collection view of the values contained in this map.
Parameters: NA
Returns: a collection view of the values contained in this map.
Exceptions: NA
Approach
Java
import java.util.IdentityHashMap;public class IdentityHashMapvalues {public static void main(String args[]) {IdentityHashMap<String, Integer> identityHashMap =new IdentityHashMap<String, Integer>();identityHashMap.put("Java", 1);identityHashMap.put("Hello", 2);System.out.println(identityHashMap.values());}}
Output:
[1, 2]
No comments:
Post a Comment