Package io.opentelemetry.api.internal
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.
- Direct Known Subclasses:
Labels.ArrayBackedLabels
@Immutable public abstract class ImmutableKeyValuePairs<K,V> extends java.lang.Object
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
sortAndFilter(Object[], boolean)
, assuming you don't want the "empty" keys to be kept in your collection.- See Also:
Labels
,Attributes
-
-
Constructor Summary
Constructors Constructor Description ImmutableKeyValuePairs()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<K,V>
asMap()
protected java.util.List<java.lang.Object>
data()
V
get(K key)
Returns the value for the givenkey
, ornull
if the key is not present.boolean
isEmpty()
int
size()
static java.util.List<java.lang.Object>
sortAndFilter(java.lang.Object[] data, boolean filterNullValues)
Sorts and dedupes the key/value pairs indata
.java.lang.String
toString()
-
-
-
Method Detail
-
data
protected java.util.List<java.lang.Object> data()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
@Nullable public V get(K key)
Returns the value for the givenkey
, ornull
if the key is not present.
-
sortAndFilter
public static java.util.List<java.lang.Object> sortAndFilter(java.lang.Object[] data, boolean filterNullValues)
Sorts and dedupes the key/value pairs indata
. IffilterNullValues
istrue
,null
values will be removed.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-