类 KeyValueHolder<K,V>
java.lang.Object
cn.taketoday.util.KeyValueHolder<K,V>
- 类型参数:
K- the key typeV- the value type
- 所有已实现的接口:
Map.Entry<K,V>
An immutable container for a key and a value, suitable for use
in creating and populating
Map instances.- 从以下版本开始:
- 4.0 2022/2/26 23:28
- 作者:
- Harry Yang
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleanCompares the specified object with this entry for equality.getKey()Gets the key from this holder.getValue()Gets the value from this holder.inthashCode()Returns the hash code value for this map entry.Replaces the value corresponding to this entry with the specified value (optional operation).toString()Returns a String representation of this map entry.
-
字段详细资料
-
key
-
value
-
-
构造器详细资料
-
KeyValueHolder
-
-
方法详细资料
-
getKey
Gets the key from this holder. -
getValue
Gets the value from this holder. -
setValue
Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator'sremoveoperation).- 指定者:
setValue在接口中Map.Entry<K,V> - 参数:
value- new value to be stored in this entry- 返回:
- old value corresponding to the entry
- 抛出:
ClassCastException- if the class of the specified value prevents it from being stored in the backing map
-
equals
Compares the specified object with this entry for equality. Returnstrueif the given object is also a map entry and the two entries' keys and values are equal. Note that key and value are non-null, so equals() can be called safely on them. -
hashCode
public int hashCode()Returns the hash code value for this map entry. The hash code iskey.hashCode() ^ value.hashCode(). Note that key and value are non-null, so hashCode() can be called safely on them. -
toString
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.
-