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

public Interface IndexedReadOnlyStringMap

extends ReadOnlyStringMap
Known Direct Subinterfaces
org.apache.logging.log4j.util.IndexedStringMap

An extension of ReadOnlyStringMap that imposes a total ordering on its keys. The map is ordered according to the natural ordering of its keys. This order is reflected when consuming the key-value pairs with a BiConsumer or a TriConsumer.

This interface views all key-value pairs as a sequence ordered by key, and allows keys and values to be accessed by their index in the sequence.

Since
2.8
See Also
ReadOnlyStringMap

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the key at the specified index or null
getKeyAt
(final int
the index of the key to return
index
)

Viewing all key-value pairs as a sequence sorted by key, this method returns the key at the specified index, or null if the specified index is less than zero or greater or equal to the size of this collection.

public <V> V

Returns:

the value at the specified index or null
getValueAt
(final int
the index of the value to return
index
)

Viewing all key-value pairs as a sequence sorted by key, this method returns the value at the specified index, or null if the specified index is less than zero or greater or equal to the size of this collection.

public int

Returns:

the index of the specified key or (-(insertion point) - 1) if the key is not found. The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or size() if all elements are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
indexOfKey
(final String
the key whose index in the ordered sequence of keys to return
key
)

Viewing all key-value pairs as a sequence sorted by key, this method returns the index of the specified key in that sequence.

Inherited from org.apache.logging.log4j.util.ReadOnlyStringMap:
containsKeyforEachforEachgetValueisEmptysizetoMap

Method Detail

getKeyAtback to summary
public String getKeyAt(final int index)

Viewing all key-value pairs as a sequence sorted by key, this method returns the key at the specified index, or null if the specified index is less than zero or greater or equal to the size of this collection.

Parameters
index:int

the index of the key to return

Returns:String

the key at the specified index or null

getValueAtback to summary
public <V> V getValueAt(final int index)

Viewing all key-value pairs as a sequence sorted by key, this method returns the value at the specified index, or null if the specified index is less than zero or greater or equal to the size of this collection.

Parameters
index:int

the index of the value to return

Returns:V

the value at the specified index or null

indexOfKeyback to summary
public int indexOfKey(final String key)

Viewing all key-value pairs as a sequence sorted by key, this method returns the index of the specified key in that sequence. If the specified key is not found, this method returns (-(insertion point) - 1).

Parameters
key:String

the key whose index in the ordered sequence of keys to return

Returns:int

the index of the specified key or (-(insertion point) - 1) if the key is not found. The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or size() if all elements are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.