org.sejda.common.collection
Class ListValueMap<K,V>

java.lang.Object
  extended by org.sejda.common.collection.ListValueMap<K,V>
Type Parameters:
K - key generic type
V - value generic type

public final class ListValueMap<K,V>
extends Object

Map where the elements added to the same key are enqueued in a List.

Author:
Andrea Vacondio

Constructor Summary
ListValueMap()
           
 
Method Summary
 void clear()
          Removes all the elements form the map
 List<V> get(K key)
          A null safe getter for the given key.
 List<V> put(K key, V value)
          Adds the input value to the List associated to the input key
 boolean remove(K key, V value)
          Removes the input value from the List associated to the input key.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListValueMap

public ListValueMap()
Method Detail

clear

public void clear()
Removes all the elements form the map


put

public List<V> put(K key,
                   V value)
Adds the input value to the List associated to the input key

Parameters:
key -
value -
Returns:
the List with the input value added

remove

public boolean remove(K key,
                      V value)
Removes the input value from the List associated to the input key.

Parameters:
key -
value -
Returns:
true if the value was found and removed.

get

public List<V> get(K key)
A null safe getter for the given key.

Parameters:
key -
Returns:
the list associated to the input key or an empty list of nothing is associated.

size

public int size()
Returns:
number of values stored by this map


Copyright © 2013 sejda. All Rights Reserved.