|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.knipp.rritoolkit.KVList
public class KVList
class that represents a key-value list as used in DENIC Key Value messages for requests and part of responses. Please note that the comparison of keys is performed case-sensitive. Therefore, all keys are expected to be lower-case normalized.
Nested Class Summary | |
---|---|
private static class |
KVList.EmptyIterator<E>
small class implementing an iterator for no elements |
static class |
KVList.Pair
small class holding a key value pair (used for the iterator |
private static class |
KVList.RemoveDisabledIterator<E>
small wrapper class of an Iterator the suppresses the use of the remove method |
private static class |
KVList.SingletonIterator<E>
small class repesenting a singleton iterator |
static interface |
KVList.Value
public interface to values. |
protected static class |
KVList.ValueImpl
inner class that implements a value |
Field Summary | |
---|---|
private java.util.LinkedHashMap<java.lang.String,KVList.ValueImpl> |
pairs
all key value pairs |
Constructor Summary | |
---|---|
KVList()
constructor |
Method Summary | |
---|---|
void |
add(java.lang.String key,
java.util.Collection<java.lang.String> col)
add a collection of values for the given key |
void |
add(java.lang.String key,
java.lang.String... values)
add all values for the given key |
void |
add(java.lang.String key,
java.lang.String value)
add a value for the given key |
void |
clear(java.lang.String key)
clear the given key |
boolean |
containsKey(java.lang.String key)
return whether the given key exists |
java.lang.String[] |
getAll(java.lang.String key)
return all strings associated with the key |
java.lang.String[] |
getAll(java.lang.String key,
java.lang.String[] values)
return all strings associated with the key |
int |
getCount(java.lang.String key)
return the number of strings associated with a key |
java.lang.String |
getFirst(java.lang.String key)
return the first string of the key |
java.util.Iterator<java.lang.String> |
getIterator(java.lang.String key)
return an iterator over all strings of a key |
java.util.Iterator<java.lang.String> |
getKeyIterator()
return an iterator over the keys |
java.util.List<java.lang.String> |
getList(java.lang.String key)
return the strings associated with the key as a list |
java.util.Iterator<KVList.Pair> |
iterator()
return an iterator over the key-value pairs |
void |
set(java.lang.String key,
java.util.Collection<java.lang.String> col)
set the given key, replacing all previous contents |
void |
set(java.lang.String key,
java.lang.String... values)
set the given key, replacing all previous contents |
void |
set(java.lang.String key,
java.lang.String value)
set the given key, replacing all previous contents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.LinkedHashMap<java.lang.String,KVList.ValueImpl> pairs
Constructor Detail |
---|
public KVList()
Method Detail |
---|
public void add(java.lang.String key, java.lang.String value)
key
- the keyvalue
- the valuepublic void add(java.lang.String key, java.lang.String... values)
key
- the keyvalues
- the valuespublic void add(java.lang.String key, java.util.Collection<java.lang.String> col)
key
- the keycol
- the valuespublic void set(java.lang.String key, java.lang.String value)
key
- the keyvalue
- the valuepublic void set(java.lang.String key, java.lang.String... values)
key
- the keyvalues
- the valuespublic void set(java.lang.String key, java.util.Collection<java.lang.String> col)
key
- the keycol
- the valuespublic void clear(java.lang.String key)
key
- the keypublic boolean containsKey(java.lang.String key)
key
- the key
true
if sopublic int getCount(java.lang.String key)
key
- the key
0
indicating that the key does not existpublic java.lang.String getFirst(java.lang.String key)
key
- the key
null
if
the key does not existpublic java.lang.String[] getAll(java.lang.String key, java.lang.String[] values)
key
- the keyvalues
- the array where the strings are stored
(may be null
)
null
. If
the key does not exist, null
is returnedpublic java.lang.String[] getAll(java.lang.String key)
key
- the key
null
public java.util.List<java.lang.String> getList(java.lang.String key)
key
- the key
public java.util.Iterator<java.lang.String> getIterator(java.lang.String key)
key
- the key
public java.util.Iterator<java.lang.String> getKeyIterator()
public java.util.Iterator<KVList.Pair> iterator()
iterator
in interface java.lang.Iterable<KVList.Pair>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |