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

      Constructors 
      Constructor Description
      Multimap()  
    • 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

        @NonNull
        public java.util.List<V> get​(K key)
        Parameters:
        key - of the values to be retrieved
        Returns:
        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.
        Parameters:
        key - of the value.
        value - to be added.
      • size

        public int size()
        Returns:
        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()
        Returns:
        Whether the map is empty.