|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.hpl.jena.util.OneToManyMap<From,To>
public class OneToManyMap<From,To>
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.
Nested Class Summary | |
---|---|
static class |
OneToManyMap.Entry<From,To>
Helper class to implement the Map.Entry interface to enumerate entries in the map |
Constructor Summary | |
---|---|
OneToManyMap()
Construct a new empty one-to-many map |
|
OneToManyMap(OneToManyMap<From,To> map)
Construct a new one-to-many map whose contents are initialised from the existing map. |
Method Summary | |
---|---|
void |
clear()
Clear all entries from the map. |
boolean |
contains(Object key,
Object value)
Answer true if this mapping contains the pair (key, value) . |
boolean |
containsKey(Object key)
Answer true if the map contains the given value as a key. |
boolean |
containsValue(Object value)
Answer true if the map contains the given object as a value stored against any key. |
Set<Map.Entry<From,To>> |
entrySet()
Answer a set of the mappings in this map. |
boolean |
equals(Object o)
Compares the specified object with this map for equality. |
To |
get(Object key)
Get a value for this key. |
Iterator<To> |
getAll(Object key)
Answer an iterator over all of the values for the given key. |
int |
hashCode()
Returns the hash code value for this map. |
boolean |
isEmpty()
Answer true if the map is empty of key-value mappings. |
Set<From> |
keySet()
Answer a set of the keys in this map |
To |
put(From key,
To value)
Associates the given value with the given key. |
void |
putAll(Map<? extends From,? extends To> m)
Put all entries from one map into this map. |
To |
remove(Object key)
Remove all of the associations for the given key. |
void |
remove(Object key,
Object value)
Remove the specific association between the given key and value. |
int |
size()
Answer the number of key-value mappings in the map |
String |
toString()
Answer a string representation of this map. |
Collection<To> |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OneToManyMap()
Construct a new empty one-to-many map
public OneToManyMap(OneToManyMap<From,To> map)
Construct a new one-to-many map whose contents are initialised from the existing map.
map
- An existing one-to-many mapMethod Detail |
---|
public void clear()
clear
in interface Map<From,To>
public boolean containsKey(Object key)
containsKey
in interface Map<From,To>
key
- The key object to test for
public boolean containsValue(Object value)
containsValue
in interface Map<From,To>
value
- The value to test for
public boolean contains(Object key, Object value)
Answer true if this mapping contains the pair
(key, value)
.
key
- A key objectvalue
- A value object
key
has value
as one of its values in this mappingpublic Set<Map.Entry<From,To>> entrySet()
entrySet
in interface Map<From,To>
public boolean equals(Object o)
equals
in interface Map<From,To>
equals
in class Object
o
- The object to be compared for equality with this map.
public To get(Object key)
get
in interface Map<From,To>
key
- The key to access the map.
getAll(java.lang.Object)
public Iterator<To> getAll(Object key)
key
- The key object
public int hashCode()
hashCode
in interface Map<From,To>
hashCode
in class Object
public boolean isEmpty()
isEmpty
in interface Map<From,To>
public Set<From> keySet()
keySet
in interface Map<From,To>
public To put(From key, To value)
put
in interface Map<From,To>
key
- The key objectvalue
- The value object
public void putAll(Map<? extends From,? extends To> m)
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.
putAll
in interface Map<From,To>
m
- The map whose contents are to be copied into this mappublic To remove(Object key)
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.
remove
in interface Map<From,To>
key
- All associations with this key will be removed
public void remove(Object key, Object value)
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.
key
- The key objectvalue
- The value objectpublic int size()
Answer the number of key-value mappings in the map
size
in interface Map<From,To>
public Collection<To> values()
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.
values
in interface Map<From,To>
public String toString()
Answer a string representation of this map. This can be quite a long string for large maps.
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |