Java IdentityHashMap.values()

Syntax

IdentityHashMap.values() has the following syntax.

public Collection <V> values()

Example

In the following code shows how to use IdentityHashMap.values() method.


import java.util.IdentityHashMap;
//  ww  w.  j  a  v a2 s . c o m
public class Main {
   public static void main(String args[]) {

      IdentityHashMap<Integer,String> ihmap = new IdentityHashMap<Integer,String>();

      ihmap.put(1, "from");
      ihmap.put(2, "java2s.com");
      ihmap.put(3, "tutorial");
      

      System.out.println("Map values: " + ihmap);
      System.out.println("Collection view of the map: " + ihmap.values());
   }    
}

The code above generates the following result.