public abstract class KeyValuePairBag extends java.util.AbstractCollection<KeyValuePair>
A Collection of of KeyValuePair instances.
Constructor and Description |
---|
KeyValuePairBag()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(KeyValuePair pair) |
void |
addAll(java.util.Map<java.lang.String,java.lang.String> map)
Convenience method to add the associated map to this collection
|
void |
addAll(java.util.Properties p)
Convenience method to add all the associated properties to this collection
|
abstract void |
addKeyValuePair(KeyValuePair pair)
Add a KeyValuePair to the collection
|
static java.util.Map<java.lang.String,java.lang.String> |
asMap(KeyValuePairBag kvps)
Convert a
KeyValuePairBag into a Map object. |
static java.util.Properties |
asProperties(KeyValuePairBag kvps)
Convert a
KeyValuePairBag into a Properties object. |
boolean |
contains(KeyValuePair kp)
Does the underlying set contain this KeyValuePair
|
boolean |
equals(java.lang.Object o) |
KeyValuePair |
getKeyValuePair(java.lang.String key)
Return the first KeyValuePair that matches the given key.
|
abstract java.util.Collection<KeyValuePair> |
getKeyValuePairs()
Returns the underlying Collection of KeyValuePair
instances
|
java.lang.String |
getValue(java.lang.String key)
Convenience method for returning the value associated with a given key.
|
java.lang.String |
getValueIgnoringKeyCase(java.lang.String key)
Return the first value associated with the passed key, ignoring the case of
the key.
|
int |
hashCode() |
java.util.Iterator<KeyValuePair> |
iterator() |
void |
removeKeyValuePair(KeyValuePair kp)
Remove the first KeyValuePair from the underlying collection.
|
void |
removeKeyValuePair(java.lang.String key)
Convenience method to remove a KeyValuePair from the
underlying collection.
|
void |
setKeyValuePairs(java.util.Collection<KeyValuePair> list)
Set the underlying Collection of KeyValuePair
instances
|
int |
size() |
java.lang.String |
toString() |
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
public abstract void addKeyValuePair(KeyValuePair pair)
Add a KeyValuePair to the collection
pair
- the KeyValuePair
to add, may not be nullpublic boolean add(KeyValuePair pair)
add
in interface java.util.Collection<KeyValuePair>
add
in class java.util.AbstractCollection<KeyValuePair>
public abstract java.util.Collection<KeyValuePair> getKeyValuePairs()
Set
of KeyValuePair
spublic void setKeyValuePairs(java.util.Collection<KeyValuePair> list)
list
- the collectionpublic KeyValuePair getKeyValuePair(java.lang.String key)
key
- the key to look uppublic void removeKeyValuePair(KeyValuePair kp)
kp
- the KeyValuePair to remove.public void removeKeyValuePair(java.lang.String key)
key
- the key.public boolean contains(KeyValuePair kp)
kp
- the keyvalue pair.public java.lang.String getValue(java.lang.String key)
Returns the String
value associated with the passed key or
null if none exists.
key
- the key to look upString
value associated with the passed key or
null if none existspublic java.lang.String getValueIgnoringKeyCase(java.lang.String key)
Return the first value associated with the passed key, ignoring the case of
the key. This may legitmately contain two keys "AAA" and "aaa". Calling
getValueIgnoringKeyCase(aaa)
may return the value associated
with either of these keys.
key
- the key to look uppublic int size()
size
in interface java.util.Collection<KeyValuePair>
size
in class java.util.AbstractCollection<KeyValuePair>
public java.lang.String toString()
toString
in class java.util.AbstractCollection<KeyValuePair>
public java.util.Iterator<KeyValuePair> iterator()
iterator
in interface java.lang.Iterable<KeyValuePair>
iterator
in interface java.util.Collection<KeyValuePair>
iterator
in class java.util.AbstractCollection<KeyValuePair>
public int hashCode()
hashCode
in interface java.util.Collection<KeyValuePair>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<KeyValuePair>
equals
in class java.lang.Object
public static java.util.Properties asProperties(KeyValuePairBag kvps)
KeyValuePairBag
into a Properties object.kvps
- the key value pair set to convert.public static java.util.Map<java.lang.String,java.lang.String> asMap(KeyValuePairBag kvps)
KeyValuePairBag
into a Map object.kvps
- the key value pair set to convert.public void addAll(java.util.Properties p)
p
- collection of properties to add.public void addAll(java.util.Map<java.lang.String,java.lang.String> map)
map
- the map to add.