Class ImmutableKeyValuePairs<K,V>
java.lang.Object
io.opentelemetry.api.internal.ImmutableKeyValuePairs<K,V>
- Type Parameters:
V- The type of the values contained in this.
An immutable set of key-value pairs.
Key-value pairs are dropped for null or empty keys.
Note: for subclasses of this, null keys will be removed, but if your key has another concept of being "empty", you'll need to remove them before calling the constructor, assuming you don't want the "empty" keys to be kept in your collection.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedImmutableKeyValuePairs(Object[] data) Stores the raw object data directly.protectedImmutableKeyValuePairs(Object[] data, Comparator<?> keyComparator) Sorts and dedupes the key/value pairs indata. -
Method Summary
Modifier and TypeMethodDescriptionasMap()data()booleanfinal voidforEach(BiConsumer<? super K, ? super V> consumer) Iterates over all the key-value pairs of labels contained by this instance.final VReturns the value for the givenkey, ornullif the key is not present.Object[]getData()Return the backing data array for these attributes.inthashCode()final booleanisEmpty()final intsize()toString()
-
Constructor Details
-
ImmutableKeyValuePairs
Stores the raw object data directly. Does not do any de-duping or sorting. If you use this constructor, you *must* guarantee that the data has been de-duped and sorted by key before it is passed here. -
ImmutableKeyValuePairs
Sorts and dedupes the key/value pairs indata.nullvalues will be removed. Keys will be compared with the givenComparator.
-
-
Method Details
-
data
-
size
public final int size() -
isEmpty
public final boolean isEmpty() -
asMap
-
get
-
forEach
Iterates over all the key-value pairs of labels contained by this instance. -
equals
-
hashCode
-
toString
-
getData
Return the backing data array for these attributes. This is only exposed for internal use by opentelemetry authors. The contents of the array MUST NOT be modified.
-