package devmanuals.com; import java.util.Map; import java.util.HashMap; import java.util.Collection; import java.util.Iterator; public class MapValues { public static void main(String args[]) { Map mp = new HashMap(); mp.put(1, "A"); mp.put(2, "B"); mp.put(3, "C"); mp.put(4, "D"); mp.put(5, null); System.out.println("Mappings are : " + mp); Collection c = mp.values(); System.out.println("Values from the set of key-value mappings : " + c); Iterator it = c.iterator(); while (it.hasNext()) System.out.println(it.next()); c.remove("C"); System.out.println("Values from the set of key-value mappings after modifying : " + c); System.out.println("The size of map = " + mp.size()); } }