Top Description Methods
org.apache.logging.log4j.util

public Interface ReadOnlyStringMap

extends Serializable
Known Direct Subinterfaces
org.apache.logging.log4j.util.StringMap, org.apache.logging.log4j.util.IndexedReadOnlyStringMap
Known Direct Implementers
org.apache.logging.log4j.spi.DefaultThreadContextMap
Imports
java.io.Serializable, java.util.Map

A read-only collection of String keys mapped to values of arbitrary type.
Since
2.7

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this data structure contains the specified key, false otherwise.
containsKey
(String
the key whose presence to check. May be null.
key
)

Returns true if this data structure contains the specified key, false otherwise.

public <
type of the value.
V
>
void
forEach(final BiConsumer<String, ? super V>
The action to be performed for each key-value pair in this collection.
action
)

Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.

public <
type of the value.
V
,
type of the third parameter.
S
>
void
forEach(final TriConsumer<String, ? super V, S>
The action to be performed for each key-value pair in this collection.
action
,
final S
the object to be passed as the third parameter to each invocation on the specified triconsumer.
state
)

Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.

public <V> V

Returns:

the value for the specified key or null.
getValue
(final String
the key whose value to return.
key
)

Returns the value for the specified key, or null if the specified key does not exist in this collection.

public boolean

Returns:

true if this collection is empty (size is zero).
isEmpty
()

Returns true if this collection is empty (size is zero), false otherwise.

public int

Returns:

the number of key-value pairs in this collection.
size
()

Returns the number of key-value pairs in this collection.

public Map<String, String>

Returns:

a mutable copy of this data structure in Map<String, String> form.
toMap
()

Returns a non-null mutable Map<String, String> containing a snapshot of this data structure.

Method Detail

containsKeyback to summary
public boolean containsKey(String key)

Returns true if this data structure contains the specified key, false otherwise.

Parameters
key:String

the key whose presence to check. May be null.

Returns:boolean

true if this data structure contains the specified key, false otherwise.

forEachback to summary
public <V> void forEach(final BiConsumer<String, ? super V> action)

Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.

Some implementations may not support structural modifications (adding new elements or removing elements) while iterating over the contents. In such implementations, attempts to add or remove elements from the BiConsumer's BiConsumer#accept(Object, Object) accept} method may cause a ConcurrentModificationException to be thrown.

Parameters
<V>
type of the value.
action:BiConsumer<String, ? super V>

The action to be performed for each key-value pair in this collection.

Exceptions
ConcurrentModificationException:
some implementations may not support structural modifications to this data structure while iterating over the contents with forEach(BiConsumer) or forEach(TriConsumer, Object).
forEachback to summary
public <V, S> void forEach(final TriConsumer<String, ? super V, S> action, final S state)

Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.

The third parameter lets callers pass in a stateful object to be modified with the key-value pairs, so the TriConsumer implementation itself can be stateless and potentially reusable.

Some implementations may not support structural modifications (adding new elements or removing elements) while iterating over the contents. In such implementations, attempts to add or remove elements from the TriConsumer's accept method may cause a ConcurrentModificationException to be thrown.

Parameters
<V>
type of the value.
<S>
type of the third parameter.
action:TriConsumer<String, ? super V, S>

The action to be performed for each key-value pair in this collection.

state:S

the object to be passed as the third parameter to each invocation on the specified triconsumer.

Exceptions
ConcurrentModificationException:
some implementations may not support structural modifications to this data structure while iterating over the contents with forEach(BiConsumer) or forEach(TriConsumer, Object).
getValueback to summary
public <V> V getValue(final String key)

Returns the value for the specified key, or null if the specified key does not exist in this collection.

Parameters
key:String

the key whose value to return.

Returns:V

the value for the specified key or null.

isEmptyback to summary
public boolean isEmpty()

Returns true if this collection is empty (size is zero), false otherwise.

Returns:boolean

true if this collection is empty (size is zero).

sizeback to summary
public int size()

Returns the number of key-value pairs in this collection.

Returns:int

the number of key-value pairs in this collection.

toMapback to summary
public Map<String, String> toMap()

Returns a non-null mutable Map<String, String> containing a snapshot of this data structure.

Returns:Map<String, String>

a mutable copy of this data structure in Map<String, String> form.