Interface MultiMap<K,V,C extends Collection<V>>

All Superinterfaces:
Map<K,C>

public interface MultiMap<K,V,C extends Collection<V>> extends Map<K,C>
  • Method Details

    • allValues

      C allValues()
      Get all elements in all Collections. This returns the same type as the mapped Collections, so if this MultiMap contains lists then there will be the same number of elements as sizeAll(), whereas if the MultiMap contains sets then duplicates may be removed. If a different type of Collection

      The returned Collection is immutable.

      Returns:
      a Collection
    • sizeAll

      int sizeAll()
      The sum of sizes of all contained keys. May be different to calling Map.size() on the result of allValues()
      Returns:
      the total number of elements in all mapped collections.
    • putSingle

      boolean putSingle(K key, V value)
      Put a single value in to the appropriate mapped collection.
      Parameters:
      key - the Key
      value - the single value to add to the collection for this key
      Returns:
      whether the Collection was modified.
    • contains

      boolean contains(Object value)
      Does this MultiMap contain the value in any of its value collections.
      Parameters:
      value - the single value to check for
      Returns:
      true if the value is contained in any of the mapped collections
    • containsValue

      boolean containsValue(Collection<?> value)
      Does this MultiMap contain the Collection as any of its value collections.
      Parameters:
      value - the collection to check for
      Returns:
      true if the value is contained in any of the mapped collections
    • copyTo

      void copyTo(Collection<V> collection)
      Copy all values to the supplied collection.
      Parameters:
      collection - to copy all the values to.