Map: containsKey(Object key)

 
import java.util.HashMap;
import java.util.Map;

class Counter {
  int i = 1;

  public String toString() {
    return Integer.toString(i);
  }
}

public class Main {
  public static void main(String[] args) {
    Map hm = new HashMap();
    for (int i = 0; i < 10; i++) {
      Integer r = new Integer(20);
      if (hm.containsKey(r))
        ((Counter) hm.get(r)).i++;
      else
        hm.put(r, new Counter());
    }
    System.out.println(hm);
  }
}
  
Home 
  Java Book 
    Collection  

Map:
  1. Map
  2. implements Map
  3. java.util.Map.Entry
  4. Map: clear()
  5. Map: containsKey(Object key)
  6. Map: containsValue(Object value)
  7. Map: equals(Object o)
  8. Map: get(Object key)
  9. Map.Entry: getKey()
  10. Map.Entry: getValue()
  11. Map: keySet()
  12. Map: put(T key, T value)
  13. Map: putAll(Map<?, ?> m)
  14. Map: remove(Object key)
  15. Map: size()
  16. Map: values()