Class NameMultimap<V>

  • Type Parameters:
    V - Value type

    public class NameMultimap<V>
    extends java.lang.Object
    Multimap whose keys are names and can be accessed with and without case sensitivity.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private NameMap<java.util.List<V>> map  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        NameMultimap()
      Creates a NameMultimap, initially empty.
      private NameMultimap​(NameMap<java.util.List<V>> map)
      Creates a NameMultimap based on an existing map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String name, boolean caseSensitive)
      Returns whether this map contains a given key, with a given case-sensitivity.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      java.util.NavigableMap<java.lang.String,​java.util.List<V>> map()
      Returns the underlying map.
      void put​(java.lang.String name, V v)
      Adds an entry to this multimap.
      java.util.Collection<java.util.Map.Entry<java.lang.String,​V>> range​(java.lang.String name, boolean caseSensitive)
      Returns a map containing all the entries in this multimap that match the given name.
      boolean remove​(java.lang.String key, V value)
      Removes all entries that have the given case-sensitive key.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • map

        private final NameMap<java.util.List<V>> map
    • Constructor Detail

      • NameMultimap

        private NameMultimap​(NameMap<java.util.List<V>> map)
        Creates a NameMultimap based on an existing map.
      • NameMultimap

        public NameMultimap()
        Creates a NameMultimap, initially empty.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • put

        public void put​(java.lang.String name,
                        V v)
        Adds an entry to this multimap.
      • remove

        public boolean remove​(java.lang.String key,
                              V value)
        Removes all entries that have the given case-sensitive key.
        Returns:
        Whether a value was removed
      • range

        public java.util.Collection<java.util.Map.Entry<java.lang.String,​V>> range​(java.lang.String name,
                                                                                         boolean caseSensitive)
        Returns a map containing all the entries in this multimap that match the given name.
      • containsKey

        public boolean containsKey​(java.lang.String name,
                                   boolean caseSensitive)
        Returns whether this map contains a given key, with a given case-sensitivity.
      • map

        public java.util.NavigableMap<java.lang.String,​java.util.List<V>> map()
        Returns the underlying map. Its size is the number of keys, not the number of values.