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.
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | ImmutableKeyValuePairs(Object[] data, Comparator<?> keyComparator)
Sorts and dedupes the key/value pairs in |
| Modifier and Type | Method and Description |
|---|---|
| public final Map | |
| private static <K> int | |
| protected final List | |
| private static <K> Object[] | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public final void | forEach(BiConsumer<? super K, ? super V> consumer)
Iterates over all the key-value pairs of labels contained by this instance. |
| public final V | |
| public Object[] | |
| public int | |
| public final boolean | |
| private static <K> void | merge(Object[] sourceArray, int beginIndex, int middleIndex, int endIndex, Object[] targetArray, Comparator<K> keyComparator)
Left source half is sourceArray[ beginIndex:middleIndex-1]. |
| private static void | |
| public final int | |
| private static Object[] | sortAndFilter(Object[] data, Comparator<?> keyComparator)
Sorts and dedupes the key/value pairs in |
| private static void | splitAndMerge(Object[] workArray, int beginIndex, int endIndex, Object[] targetArray, Comparator<?> keyComparator)
Sort the given run of array targetArray[] using array workArray[] as a source. |
| public String |
| data | back to summary |
|---|---|
| private final Object[] data | |
| hashcode | back to summary |
|---|---|
| private int hashcode | |
| ImmutableKeyValuePairs | back to summary |
|---|---|
| protected ImmutableKeyValuePairs(Object[] data) 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 | back to summary |
|---|---|
| protected ImmutableKeyValuePairs(Object[] data, Comparator<?> keyComparator) Sorts and dedupes the key/value pairs in | |
| asMap | back to summary |
|---|---|
| public final Map | |
| compareToNullSafe | back to summary |
|---|---|
| private static <K> int compareToNullSafe(K key, K pivotKey, Comparator<K> keyComparator) | |
| data | back to summary |
|---|---|
| protected final List | |
| dedupe | back to summary |
|---|---|
private static <K> Object[] dedupe(Object[] data, Comparator<K> keyComparator)
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| forEach | back to summary |
|---|---|
| public final void forEach(BiConsumer<? super K, ? super V> consumer) Iterates over all the key-value pairs of labels contained by this instance.
| |
| get | back to summary |
|---|---|
| public final V get(K key) Returns the value for the given
| |
| getData | back to summary |
|---|---|
| public Object[] 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.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isEmpty | back to summary |
|---|---|
| public final boolean isEmpty() | |
| merge | back to summary |
|---|---|
| private static <K> void merge(Object[] sourceArray, int beginIndex, int middleIndex, int endIndex, Object[] targetArray, Comparator<K> keyComparator) Left source half is sourceArray[ beginIndex:middleIndex-1]. Right source half is sourceArray[ middleIndex:endIndex-1]. Result is targetArray[ beginIndex:endIndex-1].
| |
| mergeSort | back to summary |
|---|---|
| private static void mergeSort(Object[] data, Comparator<?> keyComparator) | |
| size | back to summary |
|---|---|
| public final int size() | |
| sortAndFilter | back to summary |
|---|---|
| private static Object[] sortAndFilter(Object[] data, Comparator<?> keyComparator) Sorts and dedupes the key/value pairs in | |
| splitAndMerge | back to summary |
|---|---|
| private static void splitAndMerge(Object[] workArray, int beginIndex, int endIndex, Object[] targetArray, Comparator<?> keyComparator) Sort the given run of array targetArray[] using array workArray[] as a source. beginIndex is inclusive; endIndex is exclusive (targetArray[endIndex] is not in the set). | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |