Package io.micrometer.common
Class KeyValues
java.lang.Object
io.micrometer.common.KeyValues
An immutable collection of
KeyValues that are guaranteed to be sorted
and deduplicated by key.- Since:
- 1.10.0
-
Method Summary
Modifier and TypeMethodDescriptionReturn a newKeyValuesinstance by merging this collection and the specified key values.Return a newKeyValuesinstance by merging this collection and the specified key values.<E> KeyValuesand(@Nullable Iterable<E> elements, Function<E, String> keyExtractor, Function<E, String> valueExtractor) Return a newKeyValuesinstance by merging this collection and the key values extracted from the given elements.Return a newKeyValuesinstance by merging this collection and the specified key/value pairs.Return a newKeyValuesinstance by merging this collection and the specified key/value pair.static KeyValuesconcat(@Nullable Iterable<? extends KeyValue> keyValues, @Nullable Iterable<? extends KeyValue> otherKeyValues) Return a newKeyValuesinstance by concatenating the specified collections of key values.static KeyValuesReturn a newKeyValuesinstance by concatenating the specified key values and key/value pairs.static KeyValuesempty()Return aKeyValuesinstance that contains no elements.booleaninthashCode()iterator()static KeyValuesReturn a newKeyValuesinstance containing key values constructed from the specified key values.static KeyValuesReturn a newKeyValuesinstance containing key values constructed from the specified source key values.static <E> KeyValuesof(@Nullable Iterable<E> elements, Function<E, String> keyExtractor, Function<E, String> valueExtractor) Return a newKeyValuesinstance containing key values extracted from the given elements.static KeyValuesReturn a newKeyValuesinstance containing key values constructed from the specified key/value pairs.static KeyValuesReturn a newKeyValuesinstance containing key value constructed from the specified key/value pair.stream()Return a stream of the contained key values.toString()
-
Method Details
-
and
Return a newKeyValuesinstance by merging this collection and the specified key/value pair.- Parameters:
key- the key to addvalue- the value to add- Returns:
- a new
KeyValuesinstance
-
and
Return a newKeyValuesinstance by merging this collection and the specified key/value pairs.- Parameters:
keyValues- the key/value pairs to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
and
Return a newKeyValuesinstance by merging this collection and the specified key values.- Parameters:
keyValues- the key values to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
and
public <E> KeyValues and(@Nullable Iterable<E> elements, Function<E, String> keyExtractor, Function<E, String> valueExtractor) Return a newKeyValuesinstance by merging this collection and the key values extracted from the given elements.- Parameters:
elements- the source elementskeyExtractor- function to extract the key from the elementvalueExtractor- function to extract the value from the element- Returns:
- a new
KeyValuesinstance
-
and
Return a newKeyValuesinstance by merging this collection and the specified key values.- Parameters:
keyValues- the key values to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
iterator
-
spliterator
- Specified by:
spliteratorin interfaceIterable<KeyValue>
-
stream
Return a stream of the contained key values.- Returns:
- a key value stream
-
hashCode
public int hashCode() -
equals
-
concat
public static KeyValues concat(@Nullable Iterable<? extends KeyValue> keyValues, @Nullable Iterable<? extends KeyValue> otherKeyValues) Return a newKeyValuesinstance by concatenating the specified collections of key values.- Parameters:
keyValues- the first set of key values, elements mustn't be nullotherKeyValues- the second set of key values, elements mustn't be null- Returns:
- the merged key values
-
concat
public static KeyValues concat(@Nullable Iterable<? extends KeyValue> keyValues, String @Nullable ... otherKeyValues) Return a newKeyValuesinstance by concatenating the specified key values and key/value pairs.- Parameters:
keyValues- the first set of key values, elements mustn't be nullotherKeyValues- the additional key/value pairs to add, elements mustn't be null- Returns:
- the merged key values
-
of
public static <E> KeyValues of(@Nullable Iterable<E> elements, Function<E, String> keyExtractor, Function<E, String> valueExtractor) Return a newKeyValuesinstance containing key values extracted from the given elements.- Parameters:
elements- the source elementskeyExtractor- function to extract the key from the elementvalueExtractor- function to extract the value from the element- Returns:
- a new
KeyValuesinstance
-
of
Return a newKeyValuesinstance containing key values constructed from the specified source key values.- Parameters:
keyValues- the key values to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
of
Return a newKeyValuesinstance containing key value constructed from the specified key/value pair.- Parameters:
key- the key to addvalue- the value to add- Returns:
- a new
KeyValuesinstance
-
of
Return a newKeyValuesinstance containing key values constructed from the specified key/value pairs.- Parameters:
keyValues- the key/value pairs to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
of
Return a newKeyValuesinstance containing key values constructed from the specified key values.- Parameters:
keyValues- the key values to add, elements mustn't be null- Returns:
- a new
KeyValuesinstance
-
empty
Return aKeyValuesinstance that contains no elements.- Returns:
- an empty
KeyValuesinstance
-
toString
-