Package jodd.http
Class HttpMultiMap<V>
java.lang.Object
jodd.http.HttpMultiMap<V>
- Direct Known Subclasses:
HeadersMultiMap
General purpose HTTP multi-map. It's optimized Linked-HashMap, designed for
small number of items and
String non-null keys. It stores keys
in case-sensitive way, but, by default, you can read them in case-insensitive
way.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final booleanprivate final HttpMultiMap.MapEntry<V>[]private final HttpMultiMap.MapEntry<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate HttpMultiMap<V> addAll(HttpMultiMap<V> map) clear()Clears the map.booleanReturnstrueif name exist.entries()Returns all the entries of this map.private booleanReturnstrueif two names are the same.Returns the first value from the map associated with the name.Returns all values associated with the name.Returns first entry for given name.private intCalculates hash value of the input string.private static intindex(int hash) Calculates bucket index from the hash.booleanisEmpty()Returnstrueif map is empty.iterator()Returns iterator of all entries.names()static <T> HttpMultiMap<T> Creates new case-insensitive multimap.static <T> HttpMultiMap<T> Creates new case-insensitive map.setAll(HttpMultiMap<V> multiMap) intsize()Returns the number of keys.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
BUCKET_SIZE
private static final int BUCKET_SIZE- See Also:
-
caseSensitive
private final boolean caseSensitive -
entries
-
head
-
-
Constructor Details
-
HttpMultiMap
protected HttpMultiMap(boolean caseSensitive)
-
-
Method Details
-
newCaseInsensitiveMap
Creates new case-insensitive multimap. -
newCaseSensitiveMap
Creates new case-insensitive map. -
hash
Calculates hash value of the input string. -
index
private static int index(int hash) Calculates bucket index from the hash. -
eq
Returnstrueif two names are the same. -
size
public int size()Returns the number of keys. This is not the number of all elements. Not optimized. -
clear
Clears the map. -
contains
Returnstrueif name exist. -
isEmpty
public boolean isEmpty()Returnstrueif map is empty. -
toString
-
_set
-
setAll
-
setAll
-
set
-
setAll
-
add
-
addAll
-
addAll
-
addAll
-
_add
-
remove
-
_remove
-
get
Returns the first value from the map associated with the name. Returnsnullif name does not exist or if associated value isnull. -
getEntry
Returns first entry for given name. Returnsnullif entry does not exist. -
getAll
Returns all values associated with the name. -
iterator
Returns iterator of all entries. -
names
-
entries
Returns all the entries of this map. Case sensitivity does not influence the returned list, it always contains all of the values.
-