Class Multimap<K,​V>

  • Type Parameters:
    K - Key type
    V - Values type

    public class Multimap<K,​V>
    extends java.lang.Object
    Structure that handles singleKey-multipleValues map.
    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<V> get​(K key)  
      boolean isEmpty()  
      void put​(K key, V value)
      Add the value to the map.
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Multimap

        public Multimap()
    • Method Detail

      • get

        public java.util.List<V> get​(K key)
        key - of the values to be retrieved
        A list of values for the given key. If no values are found, an empty list is returned
      • put

        public void put​(K key,
                        V value)
        Add the value to the map.
        key - of the value.
        value - to be added.
      • size

        public int size()
        the size of all the values in the map. If n values have the same key, then n is added to the size.
      • isEmpty

        public boolean isEmpty()
        Whether the map is empty.