Esempio n. 1
0
 /**
  * Adds the specified value to the specified key's list if it is not already in that list.
  *
  * @param key the key to associate the value with
  * @param value the value to be associated
  */
 public void put(T key, V value) {
   if (!map.containsKey(key)) map.put(key, new SortedList<>(valueComparator));
   SortedList<V> temp = map.get(key);
   if (!temp.contains(value)) {
     temp.add(value);
     map.put(key, temp);
   }
 }
Esempio n. 2
0
 /**
  * Removes the specified value from the specified key's associated values list.
  *
  * @param key the key to dissociate the value from
  * @param value the value to be dissociated
  */
 public void remove(T key, V value) {
   SortedList<V> temp = map.get(key);
   temp.remove(value);
   map.put(key, temp);
 }