org.apache.commons.collections
Class DefaultMapEntry
- Map.Entry, KeyValue
public class DefaultMapEntry
A default implementation of java.util.Map.Entry
Version:
- James Strachan
- Michael A. Smith
- Neil O'Toole
- Stephen Colebourne
- Commons Collections 1.0
DefaultMapEntry()- Constructs a new
DefaultMapEntry with a null key
and null value.
|
DefaultMapEntry(Map.Entry entry)- Constructs a new
DefaultMapEntry with the given
key and given value.
|
DefaultMapEntry(Object key, Object value)- Constructs a new
DefaultMapEntry with the given
key and given value.
|
boolean | equals(Object obj)- Compares this Map Entry with another Map Entry.
|
Object | getKey()- Gets the key from the Map Entry.
|
Object | getValue()- Gets the value from the Map Entry.
|
int | hashCode()- Gets a hashCode compatible with the equals method.
|
void | setKey(Object key)- Sets the key stored in this Map Entry.
|
Object | setValue(Object value)- Sets the value stored in this Map Entry.
|
String | toString()- Written to match the output of the Map.Entry's used in
a
java.util.HashMap.
|
DefaultMapEntry
public DefaultMapEntry()
Constructs a new DefaultMapEntry with a null key
and null value.
DefaultMapEntry
public DefaultMapEntry(Map.Entry entry)
Constructs a new DefaultMapEntry with the given
key and given value.
entry - the entry to copy, must not be null
DefaultMapEntry
public DefaultMapEntry(Object key,
Object value) Constructs a new DefaultMapEntry with the given
key and given value.
key - the key for the entry, may be nullvalue - the value for the entry, may be null
equals
public boolean equals(Object obj)
Compares this Map Entry with another Map Entry.
Implemented per API documentation of
java.util.Map.Entry.equals(Object)
obj - the object to compare to
- true if equal key and value
getKey
public Object getKey()
Gets the key from the Map Entry.
- getKey in interface KeyValue
- the key
getValue
public Object getValue()
Gets the value from the Map Entry.
- getValue in interface KeyValue
- the value
hashCode
public int hashCode()
Gets a hashCode compatible with the equals method.
Implemented per API documentation of
java.util.Map.Entry.hashCode()
- a suitable hash code
setKey
public void setKey(Object key)
Sets the key stored in this Map Entry.
This Map Entry is not connected to a Map, so only the local data is changed.
key - the new key
setValue
public Object setValue(Object value)
Sets the value stored in this Map Entry.
This Map Entry is not connected to a Map, so only the local data is changed.
value - the new value
- the previous value
toString
public String toString()
Written to match the output of the Map.Entry's used in
a java.util.HashMap.
- 3.0
Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.