OO Programming with Java


Maps

  1. Generics can have more that one variable type with in particular Maps, and their various implementations: HashMaps, TreeMaps, etc., that represents associations' lists between a key and a value.
    Nb. Lists can be viewed as specific Maps where keys are simply integers.
interface Map<K,V> {
  V get(Object key); // use Objects.equals(key, k)
  V put(K key, V value);
  Set<K> keySet();
  ...
}

10 - 13