| java.lang.Object com.hp.hpl.jena.util.OneToManyMap
OneToManyMap | public class OneToManyMap implements Map(Code) | | An extension to a standard map that supports one-to-many mappings: that is, there
may be zero, one or many values corresponding to a given key.
author: Ian Dickinson, HP Labs (email) version: CVS info: $Id: OneToManyMap.java,v 1.15 2008/01/02 12:07:44 andy_seaborne Exp $ |
Inner Class :public static class Entry implements Map.Entry | |
Method Summary | |
public void | clear() Clear all entries from the map. | public boolean | contains(Object key, Object value) | public boolean | containsKey(Object key) Answer true if the map contains the given value as a key. | public boolean | containsValue(Object value) Answer true if the map contains the given object as a value
stored against any key. | public Set | entrySet() Answer a set of the mappings in this map. | public boolean | equals(Object o) Compares the specified object with this map for equality.
Returns true if the given object is also a map and the two Maps
represent the same mappings. | public Object | get(Object key) Get a value for this key. | public Iterator | getAll(Object key) Answer an iterator over all of the values for the given key. | public int | hashCode() Returns the hash code value for this map. | public boolean | isEmpty() Answer true if the map is empty of key-value mappings. | public Set | keySet() | public Object | put(Object key, Object value) Associates the given value with the given key. | public void | putAll(Map m) Put all entries from one map into this map. | public Object | remove(Object key) Remove all of the associations for the given key. | public void | remove(Object key, Object value) Remove the specific association between the given key and value. | public int | size() | public String | toString() Answer a string representation of this map. | public Collection | values() Returns a collection view of the values contained in this map. |
OneToManyMap | public OneToManyMap()(Code) | | Construct a new empty one-to-many map
|
OneToManyMap | public OneToManyMap(OneToManyMap map)(Code) | | Construct a new one-to-many map whose contents are
initialised from the existing map.
Parameters: map - An existing one-to-many map |
clear | public void clear()(Code) | | Clear all entries from the map.
|
contains | public boolean contains(Object key, Object value)(Code) | | Answer true if this mapping contains the pair
(key, value) .
Parameters: key - A key object Parameters: value - A value object True if key has value as one of its values in this mapping |
containsKey | public boolean containsKey(Object key)(Code) | | Answer true if the map contains the given value as a key.
Parameters: key - The key object to test for True or false |
containsValue | public boolean containsValue(Object value)(Code) | | Answer true if the map contains the given object as a value
stored against any key. Note that this is quite an expensive
operation in the current implementation.
Parameters: value - The value to test for True if the value is in the map |
entrySet | public Set entrySet()(Code) | | Answer a set of the mappings in this map. Each member of the set will
be a Map.Entry value.
A Set of the mappings as Map.Entry values. |
equals | public boolean equals(Object o)(Code) | | Compares the specified object with this map for equality.
Returns true if the given object is also a map and the two Maps
represent the same mappings. More formally, two maps t1 and t2 represent
the same mappings if t1.entrySet().equals(t2.entrySet()).
This ensures that the equals method works properly across different
implementations of the Map interface.
Parameters: o - The object to be compared for equality with this map. True if the specified object is equal to this map. |
get | public Object get(Object key)(Code) | | Get a value for this key. Since this map is explicitly designed to
allow there to be more than one mapping per key, this method will return
an undetermined instance of the mapping. If no mapping exists, or the
selected value is null, null is returned.
Parameters: key - The key to access the map. One of the values this key corresponds to, or null. See Also: OneToManyMap.getAll |
getAll | public Iterator getAll(Object key)(Code) | | Answer an iterator over all of the values for the given key. An iterator
is always supplied, even if the key is not present.
Parameters: key - The key object An iterator over all of the values for this key in the map |
hashCode | public int hashCode()(Code) | | Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hashCodes of each entry in the map's
entrySet view. This ensures that t1.equals(t2) implies
that t1.hashCode()==t2.hashCode() for any two maps t1 and t2,
as required by the general contract of Object.hashCode
|
isEmpty | public boolean isEmpty()(Code) | | Answer true if the map is empty of key-value mappings.
True if there are no entries. |
keySet | public Set keySet()(Code) | | Answer a set of the keys in this map
The keys of the map as a Set |
put | public Object put(Object key, Object value)(Code) | | Associates the given value with the given key. Since this map formulation
allows many values for one key, previous associations with the key are not
lost. Consequently, the method always returns null (since the replaced value
is not defined).
Parameters: key - The key object Parameters: value - The value object Null. |
putAll | public void putAll(Map m)(Code) | | Put all entries from one map into this map. Tests for m being a
OneToManyMap, and, if so, copies all of the entries for each key.
Parameters: m - The map whose contents are to be copied into this map |
remove | public Object remove(Object key)(Code) | | Remove all of the associations for the given key. If only a specific
association is to be removed, use
OneToManyMap.remove(java.lang.Object,java.lang.Object) instead. Has no effect if the key is not present in the map. Since no
single specific association with the key is defined, this method always
returns null.
Parameters: key - All associations with this key will be removed null |
remove | public void remove(Object key, Object value)(Code) | | Remove the specific association between the given key and value. Has
no effect if the association is not present in the map. If all values
for a particular key have been removed post removing this particular
association, the key will no longer appear as a key in the map.
Parameters: key - The key object Parameters: value - The value object |
size | public int size()(Code) | | Answer the number of key-value mappings in the map
The number of key-value pairs. |
toString | public String toString()(Code) | | Answer a string representation of this map. This can be quite a long string for
large maps.
|
values | public Collection values()(Code) | | Returns a collection view of the values contained in this map.
Specifically, this will be a set, so duplicate values that appear
for multiple keys are suppressed.
A set of the values contained in this map. |
|
|