Package io.microsphere.collection
Class DefaultEntry<K,V>
- java.lang.Object
-
- io.microsphere.collection.DefaultEntry<K,V>
-
- Type Parameters:
K
- the type of the keyV
- the type of the value
- All Implemented Interfaces:
java.util.Map.Entry<K,V>
- Direct Known Subclasses:
ImmutableEntry
public class DefaultEntry<K,V> extends java.lang.Object implements java.util.Map.Entry<K,V>
A default implementation of theMap.Entry
interface, representing a key-value pair. This class provides an immutable key and a mutable value, allowing for updates to the value while keeping the same key. It is suitable for use in custom map implementations or other scenarios where a modifiable entry needs to be maintained.- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
Map.Entry
-
-
Constructor Summary
Constructors Constructor Description DefaultEntry(K key, V value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
K
getKey()
V
getValue()
int
hashCode()
static <K,V>
DefaultEntry<K,V>of(K key, V value)
Create a new instance ofDefaultEntry
with the specified key and value.V
setValue(V value)
java.lang.String
toString()
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
of
public static <K,V> DefaultEntry<K,V> of(K key, V value)
Create a new instance ofDefaultEntry
with the specified key and value.- Type Parameters:
K
- the type of the keyV
- the type of the value- Parameters:
key
- the keyvalue
- the value- Returns:
- a new instance of
DefaultEntry
-
-