IdentityHashMap values Example
IdentityHashMap class values example. This example shows you how to use values method.
IdentityHashMap class values example. public Collection values() Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa.
Here is the code
/**
* @ # Values.java
* A class repersenting use to Values method
* of IdentityHashMap class in java.util package
* version 26 May 2008
* author Rose India
*/
import java.util.*;
public class Values {
public static void main(String args[]) {
IdentityHashMap map = new IdentityHashMap();
//Add the mapping into the map
map.put(1, "A");
map.put(2, "A");
map.put(3, "B");
Collection list = map.values();
System.out.println(list);
}
} |
|