Add an element to the map. @param key The key to store the value under. If the key already exists the value will be added to the collection for that key, it will not replace the existing value (as in a standard map). @param value value to store.
(K key, V value)
| 63 | * @param value value to store. |
| 64 | */ |
| 65 | public void put(K key, V value) { |
| 66 | ArrayList<V> list = mMap.get(key); |
| 67 | if (list == null) { |
| 68 | list = new ArrayList<V>(); |
| 69 | list.add(value); |
| 70 | mMap.put(key, list); |
| 71 | } else { |
| 72 | list.add(value); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Add a key to the map with a collection of elements. |