org.semanticweb.elk.util.collections
Class AbstractHashMultimap<Key,Value>
java.lang.Object
java.util.AbstractMap<K,V>
org.semanticweb.elk.util.collections.ArrayHashMap<Key,Collection<Value>>
org.semanticweb.elk.util.collections.AbstractHashMultimap<Key,Value>
- Type Parameters:
Key - Value -
- All Implemented Interfaces:
- Map<Key,Collection<Value>>, Multimap<Key,Value>
- Direct Known Subclasses:
- HashListMultimap, HashSetMultimap
public abstract class AbstractHashMultimap<Key,Value>
- extends ArrayHashMap<Key,Collection<Value>>
- implements Multimap<Key,Value>
Implementation of Multimap backed by an ArrayHashMap
- Author:
- Frantisek Simancik
AbstractHashMultimap
public AbstractHashMultimap()
AbstractHashMultimap
public AbstractHashMultimap(int i)
newRecord
protected abstract Collection<Value> newRecord()
contains
public boolean contains(Key key,
Value value)
- Description copied from interface:
Multimap
- Tests if the key-value pair occurs in this multimap
- Specified by:
contains in interface Multimap<Key,Value>
- Parameters:
key - the key of the pairvalue - the value of the pair
- Returns:
- true if this multimap contains the pair, false
otherwise
add
public boolean add(Key key,
Value value)
- Description copied from interface:
Multimap
- Stores the key-value pair in this multimap
- Specified by:
add in interface Multimap<Key,Value>
- Parameters:
key - the key of the pairvalue - the value of the pair
- Returns:
- true if the multimap has changed as a result of the
operation, fase otherwise
get
public Collection<Value> get(Object key)
- Description copied from interface:
Multimap
- Returns the collection of values associated with the given key in this
multimap
- Specified by:
get in interface Map<Key,Collection<Value>>- Specified by:
get in interface Multimap<Key,Value>- Overrides:
get in class ArrayHashMap<Key,Collection<Value>>
- Parameters:
key - the key for which to retrieve the values
- Returns:
- the collection of values associated with the given key in this
multimap
getOld
public Collection<Value> getOld(Object key)
remove
public boolean remove(Object key,
Object value)
- Description copied from interface:
Multimap
- Removes the key-value pair from this multimap
- Specified by:
remove in interface Multimap<Key,Value>
- Parameters:
key - the key of the pairvalue - the value of the pair
- Returns:
- true if the multimap has changed as a result of the
operation, fase otherwise
Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.