|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.collections.HashedListMap<K,I>
public class HashedListMap<K,I>
This class defines a mapping from on item to a list of items.
Constructor Summary | |
---|---|
HashedListMap()
Create new hashed list map. |
|
HashedListMap(HashedListMap<K,I> other)
Copy constructor. |
|
HashedListMap(java.util.Map<K,java.util.List<I>> map)
Create new hashed list map with a specified map. |
Method Summary | |
---|---|
void |
add(K key,
I item)
Add an item to the list identified by a key. |
void |
addAll(HashedListMap<K,I> other)
Adds all elements from another hashed list map. |
void |
addAll(K key,
java.util.Collection<I> items)
Add all items to the list identified by a key. |
boolean |
areAllListsEmpty()
Checks if all lists stored in the map are empty. |
void |
clear()
Clear map. |
boolean |
containsList(K key)
Check if a list is present for a given key. |
java.util.List<I> |
createList(K key)
Create an empty list for a key. |
java.util.Set<K> |
getKeys()
Get keys. |
java.util.List<I> |
getList(K key)
Get list for key. |
java.util.List<I> |
getValues()
Return all values from all lists. |
java.util.Map<K,I[]> |
listsToArrays(java.lang.Class<I> type)
Converts the HashedListMap to a map with arrays |
void |
removeAllLists(java.util.Collection<K> keys)
Removes the lists stored for a collection of keys |
void |
removeList(K key)
Removes the list stored for a key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashedListMap()
public HashedListMap(java.util.Map<K,java.util.List<I>> map)
public HashedListMap(HashedListMap<K,I> other)
Method Detail |
---|
public java.util.List<I> createList(K key)
public java.util.List<I> getList(K key)
null
public void add(K key, I item)
public void addAll(K key, java.util.Collection<I> items)
public void addAll(HashedListMap<K,I> other)
public boolean containsList(K key)
public void removeList(K key)
public void removeAllLists(java.util.Collection<K> keys)
public java.util.Set<K> getKeys()
public java.util.List<I> getValues()
public boolean areAllListsEmpty()
getValues()
returns an empty list.
public void clear()
public java.util.Map<K,I[]> listsToArrays(java.lang.Class<I> type)
HashedListMap
to a map with arrays
type
- Type of the target array
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |