Package org.apache.logging.log4j.util
Interface StringMap
- All Superinterfaces:
ReadOnlyStringMap
,Serializable
- All Known Subinterfaces:
IndexedStringMap
- All Known Implementing Classes:
SortedArrayStringMap
Exposes methods to add and remove key-value pairs to and from
ReadOnlyStringMap
.- Since:
- 2.7
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all key-value pairs from this collection.boolean
Indicates whether some other object is "equal to" this one.void
freeze()
Makes this collection immutable.int
hashCode()
Returns a hash code value for the object.boolean
isFrozen()
void
putAll
(ReadOnlyStringMap source) Copies all key-value pairs from the specifiedReadOnlyStringMap
into thisStringMap
.void
Puts the specified key-value pair into the collection.void
Removes the key-value pair for the specified key from this data structure.Methods inherited from interface org.apache.logging.log4j.util.ReadOnlyStringMap
containsKey, forEach, forEach, getValue, isEmpty, size, toMap
-
Method Details
-
clear
void clear()Removes all key-value pairs from this collection.- Throws:
ConcurrentModificationException
- some implementations may not support structural modifications to this data structure while iterating over the contents withReadOnlyStringMap.forEach(BiConsumer)
orReadOnlyStringMap.forEach(TriConsumer, Object)
.UnsupportedOperationException
- if this collection has been frozen.
-
equals
Indicates whether some other object is "equal to" this one. -
freeze
void freeze()Makes this collection immutable. Attempts to modify the collection after thefreeze()
method was called will result in anUnsupportedOperationException
being thrown. -
hashCode
int hashCode()Returns a hash code value for the object. -
isFrozen
boolean isFrozen()- Returns:
true
if this object has been frozen,false
otherwise
-
putAll
Copies all key-value pairs from the specifiedReadOnlyStringMap
into thisStringMap
.- Parameters:
source
- theReadOnlyStringMap
to copy key-value pairs from- Throws:
ConcurrentModificationException
- some implementations may not support structural modifications to this data structure while iterating over the contents withReadOnlyStringMap.forEach(BiConsumer)
orReadOnlyStringMap.forEach(TriConsumer, Object)
.UnsupportedOperationException
- if this collection has been frozen.
-
putValue
Puts the specified key-value pair into the collection.- Parameters:
key
- the key to add or remove. Keys may benull
.value
- the value to add. Values may benull
.- Throws:
ConcurrentModificationException
- some implementations may not support structural modifications to this data structure while iterating over the contents withReadOnlyStringMap.forEach(BiConsumer)
orReadOnlyStringMap.forEach(TriConsumer, Object)
.UnsupportedOperationException
- if this collection has been frozen.
-
remove
Removes the key-value pair for the specified key from this data structure.- Parameters:
key
- the key to remove. May benull
.- Throws:
ConcurrentModificationException
- some implementations may not support structural modifications to this data structure while iterating over the contents withReadOnlyStringMap.forEach(BiConsumer)
orReadOnlyStringMap.forEach(TriConsumer, Object)
.UnsupportedOperationException
- if this collection has been frozen.
-