Package com.openmeet.shared.utils
Class MultiMapList<K,V>
java.lang.Object
com.openmeet.shared.utils.MultiMapList<K,V>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the current bufferMap as a row in the MultiMapList.voidaddEntryInCurrentRow(K key, V value) Adds an entry to the bufferMapReturns the value(s) of the key specified at a specific row.getRow(int row) Returns all the values of a specific row.intReturns the number of rows in the MultiMapList.toString()
-
Constructor Details
-
MultiMapList
public MultiMapList()
-
-
Method Details
-
toString
-
getRowsNumber
public int getRowsNumber()Returns the number of rows in the MultiMapList.- Returns:
- an integer representing the number of rows in the MultiMapList.
-
get
Returns the value(s) of the key specified at a specific row.- Parameters:
key- the key for which we want to get the valuesrow- 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
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
Adds an entry to the bufferMap- Parameters:
key- the key for which we want to add the valuevalue- the value that will be added to the bufferMap for the key
-
addCurrentRow
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
-