Class MultiMapList<K,V>

java.lang.Object
com.openmeet.shared.utils.MultiMapList<K,V>

public class MultiMapList<K,V> extends Object
This is a Java class that implements a MultiMapList, which is a collection that maps keys to values, similar to a Map, but in which each key may be associated with multiple values.
See Also:
  • Constructor Details

    • MultiMapList

      public MultiMapList()
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRowsNumber

      public int getRowsNumber()
      Returns the number of rows in the MultiMapList.
      Returns:
      an integer representing the number of rows in the MultiMapList.
    • get

      public Collection<V> get(K key, int row) throws IndexOutOfBoundsException
      Returns the value(s) of the key specified at a specific row.
      Parameters:
      key - the key for which we want to get the values
      row - an integer representing the row number in which we are looking for the values.
      Returns:
      a Collection of V objects representing the values
      Throws:
      IndexOutOfBoundsException - if the row number is out of bounds
    • getRow

      public Collection<V> getRow(int row) throws IndexOutOfBoundsException
      Returns all the values of a specific row.
      Parameters:
      row - an integer representing the row number in which we are looking for the values.
      Returns:
      a Collection of V objects representing the values of the specified row.
      Throws:
      IndexOutOfBoundsException - if the row number is out of bounds
    • addEntryInCurrentRow

      public void addEntryInCurrentRow(K key, V value)
      Adds an entry to the bufferMap
      Parameters:
      key - the key for which we want to add the value
      value - the value that will be added to the bufferMap for the key
    • addCurrentRow

      public void addCurrentRow() throws NullPointerException
      Adds the current bufferMap as a row in the MultiMapList. The addCurrentRow method should be called after adding the entries to the bufferMap using the addEntryInCurrentRow method, this will add the entries to the MultiMapList as a new row.
      Throws:
      NullPointerException - if the bufferMap is null