|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--torero.util.OneToManyMap
A collection class for mapping one key to many values. In difference to the Hashmap this collection allows to associate more than one value to a certain key. Therefore binnings can be implemented with this collection type. Note that this implementation is not synchronized. If multiple threads access this map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. The OneToManyMap also supports serialisation. Looking up the values associated to a key is done with hashing.
Constructor Summary | |
OneToManyMap(int size)
The constuctor argument is used to set the initial capacity of key values. |
Method Summary | |
void |
clear()
Removes all keys and their associated values from this OneToManyMap. |
ListIterator |
get(Object key)
Returns an iterator of Objects associated to the given key. |
Iterator |
getAllValues()
Returns an iterator of all values of this OneToManyMap. |
Iterator |
getKeys()
Returns an iterator of all keys of this OneToManyMap. |
boolean |
put(Object key,
Object value)
Adds the given value to the given key and returns false if the value is already associated to the given key. |
boolean |
removeKey(Object key)
Remove the given key and all its values from this OneToManyMap. |
boolean |
removeValue(Object key,
Object value)
Remove the given value from the given key in this OneToManyMap. |
int |
size()
Returns the number of keys this OneToManyMap has. |
String |
toString()
Returns a String representation of this OneToManyMap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OneToManyMap(int size)
size
- takes the number of key elements initally used.Method Detail |
public ListIterator get(Object key)
key
- takes the key object.public Iterator getKeys()
public Iterator getAllValues()
public boolean put(Object key, Object value)
key
- takes the key the value should be added tovalue
- takes the value that should be addedpublic boolean removeKey(Object key)
key
- takes the key the value should be added topublic boolean removeValue(Object key, Object value)
key
- takes the key from where the given value should be removedvalue
- takes the value to remove from the given keypublic void clear()
public int size()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |