Class MutableEntry<K,V>

java.lang.Object
org.miaixz.bus.core.center.map.AbstractEntry<K,V>
org.miaixz.bus.core.lang.mutable.MutableEntry<K,V>
Type Parameters:
K - 键类型
V - 值类型
All Implemented Interfaces:
Serializable, Map.Entry<K,V>, Mutable<Map.Entry<K,V>>

public class MutableEntry<K,V> extends AbstractEntry<K,V> implements Mutable<Map.Entry<K,V>>, Serializable
可变键和值的Map.Entry实现,可以修改键和值
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Details

    • key

      protected K key
    • value

      protected V value
  • Constructor Details

    • MutableEntry

      public MutableEntry(K key, V value)
      构造
      Parameters:
      key - 键
      value - 值
  • Method Details

    • of

      public static <K, V> MutableEntry<K,V> of(K key, V value)
      创建MutableEntry
      Type Parameters:
      K - 键类型
      V - 值类型
      Parameters:
      key - 键
      value - 值
      Returns:
      MutableEntry
    • getKey

      public K getKey()
      获取键
      Specified by:
      getKey in interface Map.Entry<K,V>
      Returns:
    • getValue

      public V getValue()
      获取值
      Specified by:
      getValue in interface Map.Entry<K,V>
      Returns:
    • setKey

      public K setKey(K key)
      设置键
      Parameters:
      key - 新键
      Returns:
      old data
    • setValue

      public V setValue(V value)
      设置值
      Specified by:
      setValue in interface Map.Entry<K,V>
      Overrides:
      setValue in class AbstractEntry<K,V>
      Parameters:
      value - 新值
      Returns:
      old value
    • get

      public Map.Entry<K,V> get()
      Description copied from interface: Mutable
      获得原始值
      Specified by:
      get in interface Mutable<K>
      Returns:
      原始值
    • set

      public void set(Map.Entry<K,V> pair)
      Description copied from interface: Mutable
      设置值
      Specified by:
      set in interface Mutable<K>
      Parameters:
      pair - 值