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 newKeyValues
instance by merging this collection and the specified key values.Return a newKeyValues
instance by merging this collection and the specified key values.<E> KeyValues
Return a newKeyValues
instance by merging this collection and the key values extracted from the given elements.Return a newKeyValues
instance by merging this collection and the specified key/value pairs.Return a newKeyValues
instance by merging this collection and the specified key/value pair.static KeyValues
Return a newKeyValues
instance by concatenating the specified collections of key values.static KeyValues
Return a newKeyValues
instance by concatenating the specified key values and key/value pairs.static KeyValues
empty()
Return aKeyValues
instance that contains no elements.boolean
int
hashCode()
iterator()
static KeyValues
Return a newKeyValues
instance containing key values constructed from the specified key values.static KeyValues
Return a newKeyValues
instance containing key values constructed from the specified source key values.static <E> KeyValues
Return a newKeyValues
instance containing key values extracted from the given elements.static KeyValues
Return a newKeyValues
instance containing key values constructed from the specified key/value pairs.static KeyValues
Return a newKeyValues
instance 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 newKeyValues
instance by merging this collection and the specified key/value pair.- Parameters:
key
- the key to addvalue
- the value to add- Returns:
- a new
KeyValues
instance
-
and
Return a newKeyValues
instance 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
KeyValues
instance
-
and
Return a newKeyValues
instance by merging this collection and the specified key values.- Parameters:
keyValues
- the key values to add, elements mustn't be null- Returns:
- a new
KeyValues
instance
-
and
public <E> KeyValues and(@Nullable Iterable<E> elements, Function<E, String> keyExtractor, Function<E, String> valueExtractor) Return a newKeyValues
instance 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
KeyValues
instance
-
and
Return a newKeyValues
instance by merging this collection and the specified key values.- Parameters:
keyValues
- the key values to add, elements mustn't be null- Returns:
- a new
KeyValues
instance
-
iterator
-
spliterator
- Specified by:
spliterator
in 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 newKeyValues
instance 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, @Nullable String... otherKeyValues) Return a newKeyValues
instance 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 newKeyValues
instance 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
KeyValues
instance
-
of
Return a newKeyValues
instance 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
KeyValues
instance
-
of
Return a newKeyValues
instance containing key value constructed from the specified key/value pair.- Parameters:
key
- the key to addvalue
- the value to add- Returns:
- a new
KeyValues
instance
-
of
Return a newKeyValues
instance 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
KeyValues
instance
-
of
Return a newKeyValues
instance containing key values constructed from the specified key values.- Parameters:
keyValues
- the key values to add, elements mustn't be null- Returns:
- a new
KeyValues
instance
-
empty
Return aKeyValues
instance that contains no elements.- Returns:
- an empty
KeyValues
instance
-
toString
-