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. @param pos position in the arraylist to store the new
(Operator key, Operator value, int pos)
| 50 | * Positions are zero based. |
| 51 | */ |
| 52 | public void put(Operator key, Operator value, int pos) { |
| 53 | ArrayList<Operator> list = mMap.get(key); |
| 54 | if (list == null) { |
| 55 | list = new ArrayList<Operator>(); |
| 56 | if (pos != 0) { |
| 57 | throw new IndexOutOfBoundsException( |
| 58 | "First edge cannot have position greater than 1"); |
| 59 | } |
| 60 | list.add(value); |
| 61 | mMap.put(key, list); |
| 62 | } else { |
| 63 | list.add(pos, value); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Remove one value from an existing key and return which position in |