Class DefaultKeyValue
- java.lang.Object
-
- org.apache.commons.collections.keyvalue.AbstractKeyValue
-
- org.apache.commons.collections.keyvalue.DefaultKeyValue
-
- All Implemented Interfaces:
KeyValue
@Deprecated(since="2021-04-30") public class DefaultKeyValue extends AbstractKeyValue
Deprecated.Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.A mutableKeyValuepair that does not implementMap.Entry.Note that a
DefaultKeyValueinstance may not contain itself as a key or value.- Since:
- Commons Collections 3.0
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyValue()Deprecated.Constructs a new pair with a null key and null value.DefaultKeyValue(java.lang.Object key, java.lang.Object value)Deprecated.Constructs a new pair with the specified key and given value.DefaultKeyValue(java.util.Map.Entry entry)Deprecated.Constructs a new pair from the specifiedMap.Entry.DefaultKeyValue(KeyValue pair)Deprecated.Constructs a new pair from the specifiedKeyValue.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Deprecated.Compares thisMap.Entrywith anotherMap.Entry.inthashCode()Deprecated.Gets a hashCode compatible with the equals method.java.lang.ObjectsetKey(java.lang.Object key)Deprecated.Sets the key.java.lang.ObjectsetValue(java.lang.Object value)Deprecated.Sets the value.java.util.Map.EntrytoMapEntry()Deprecated.Returns a newMap.Entryobject with key and value from this pair.-
Methods inherited from class org.apache.commons.collections.keyvalue.AbstractKeyValue
getKey, getValue, toString
-
-
-
-
Constructor Detail
-
DefaultKeyValue
public DefaultKeyValue()
Deprecated.Constructs a new pair with a null key and null value.
-
DefaultKeyValue
public DefaultKeyValue(java.lang.Object key, java.lang.Object value)Deprecated.Constructs a new pair with the specified key and given value.- Parameters:
key- the key for the entry, may be nullvalue- the value for the entry, may be null
-
DefaultKeyValue
public DefaultKeyValue(KeyValue pair)
Deprecated.Constructs a new pair from the specifiedKeyValue.- Parameters:
pair- the pair to copy, must not be null- Throws:
java.lang.NullPointerException- if the entry is null
-
DefaultKeyValue
public DefaultKeyValue(java.util.Map.Entry entry)
Deprecated.Constructs a new pair from the specifiedMap.Entry.- Parameters:
entry- the entry to copy, must not be null- Throws:
java.lang.NullPointerException- if the entry is null
-
-
Method Detail
-
setKey
public java.lang.Object setKey(java.lang.Object key)
Deprecated.Sets the key.- Parameters:
key- the new key- Returns:
- the old key
- Throws:
java.lang.IllegalArgumentException- if key is this object
-
setValue
public java.lang.Object setValue(java.lang.Object value)
Deprecated.Sets the value.- Parameters:
value- the new value- Returns:
- the old value of the value
- Throws:
java.lang.IllegalArgumentException- if value is this object
-
toMapEntry
public java.util.Map.Entry toMapEntry()
Deprecated.Returns a newMap.Entryobject with key and value from this pair.- Returns:
- a MapEntry instance
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.Compares thisMap.Entrywith anotherMap.Entry.Returns true if the compared object is also a
DefaultKeyValue, and its key and value are equal to this object's key and value.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare to- Returns:
- true if equal key and value
-
hashCode
public int hashCode()
Deprecated.Gets a hashCode compatible with the equals method.Implemented per API documentation of
Map.Entry.hashCode(), however subclasses may override this.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a suitable hash code
-
-