edu.northwestern.at.utils

## Class KeyedLists<K extends java.lang.Comparable,V>

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<K,java.util.List<V>>
    - - edu.northwestern.at.utils.KeyedLists<K,V>

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.util.List<V>>

      public class KeyedLists<K extends java.lang.Comparable,V>
      extends java.util.HashMap<K,java.util.List<V>>

  Maps keys and lists of values.

  This class extends HashMap to allow each key to take an ArrayList of values.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyedLists()` Create a keyed lists object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(java.lang.Object key, int index)` Get indexed entry in list for specified key.
    `java.lang.Object` | `put(K key, V value)` Add an entry to list for a key.
    `java.lang.Object` | `putAll(K key, java.util.Collection<V> collection)` Add all entries from a collection to list for a key.
    `boolean` | `remove(K key, V value)` Remove an entry from list for a key.

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Constructor Detail

    - #### KeyedLists

          public KeyedLists()

      Create a keyed lists object.

  - ### Method Detail

    - #### get

          public java.lang.Object get(java.lang.Object key,
                             int index)

      Get indexed entry in list for specified key.
      Parameters:
        `key` - The key.
        `index` - Index of list entry to retrieve.
      Returns:
        The indexed entry from the list for the given key. May be null if not found.

    - #### putAll

          public java.lang.Object putAll(K key,
                                java.util.Collection<V> collection)

      Add all entries from a collection to list for a key.
      Parameters:
        `key` - The key.
        `collection` - Collection whose entries should be added.
      Returns:
        Updated list.

    - #### put

          public java.lang.Object put(K key,
                             V value)

      Add an entry to list for a key.
      Parameters:
        `key` - The key.
        `value` - Value to add to key's list.
      Returns:
        Updated list.

    - #### remove

          public boolean remove(K key,
                       V value)

      Remove an entry from list for a key.
      Parameters:
        `key` - The key.
        `value` - Value to add to key's list.
      Returns:
        true if entry removed. Only the first occurrence of the value is removed.

        The key is removed should the associated list become empty.