NullableKeyValueHolder

An immutable container for a key and a value, both of which are nullable.

This is a {@docRoot}/java.base/java/lang/doc-files/ValueBased.html class; programmers should treat instances that are .equals as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.

Parameters

the value type

Constructors

Link copied to clipboard
constructor(k: K, v: V)

Constructs a NullableKeyValueHolder.

constructor(entry: MutableMap.MutableEntry<K, V>)

Constructs a NullableKeyValueHolder from a Map.Entry. No need for an idempotent copy at this time.

Properties

Link copied to clipboard
open override val key: K

Gets the key from this holder.

Link copied to clipboard
open override val value: V

Gets the value from this holder.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries' keys and values are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns the hash code value for this map entry. The hash code is key.hashCode() ^ value.hashCode().

Link copied to clipboard
open override fun setValue(value: V): V
Link copied to clipboard
open override fun toString(): String

Returns a String representation of this map entry. This implementation returns the string representation of this entry's key followed by the equals character ("=") followed by the string representation of this entry's value.