|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.util.Pair
The simplest possible implementation of Map.Entry
. Instances
of this class contains references to the key
and
value
set in the constructor.
Field Summary | |
static String |
versionId
|
Constructor Summary | |
Pair(Object key,
Object value)
Creates a new Pair instance. |
Method Summary | |
protected Object |
clone()
Return a shallow copy of this pair. |
boolean |
equals(Object o)
Compare the specified object with this pair. |
Object |
getKey()
Returns the key corresponding to this pair. |
Object |
getValue()
Returns the value corresponding to this pair. |
int |
hashCode()
The hash code for this pair. |
Object |
setValue(Object value)
Replaces the value corresponding to this pair with the specified value. |
String |
toString()
Convert this pair to a String . |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public Pair(Object key, Object value)
Creates a new Pair
instance.
key
- the key for this pair.value
- the value for this pair.Method Detail |
protected Object clone()
Return a shallow copy of this pair. The key and value of the new pair refer to the same objects as the key and value in the pair being cloned.
public final Object getKey()
Returns the key corresponding to this pair.
getKey
in interface Map.Entry
public final Object getValue()
Returns the value corresponding to this pair.
getValue
in interface Map.Entry
public Object setValue(Object value)
Replaces the value corresponding to this pair with the specified value.
setValue
in interface Map.Entry
public boolean equals(Object o)
Compare the specified object with this pair. Returns true if the given
object is also a Map.Entry
and its key and value are
equal to those of this pair. More formally, two entries e1 and e2
represent the same mapping if
(e1.getKey()==null ? e2.getKey()==null : e1.getKey().equals(e2.getKey())) && (e1.getValue()==null ? e2.getValue()==null : e1.getValue().equals(e2.getValue()))
equals
in interface Map.Entry
o
- object to be compared for equality with this pair.
public int hashCode()
The hash code for this pair. The hash code is the bitwise exclusive or
of the hash codes of the key and the value. If either of these entries
is null
, its hash code is taken to be 0
in
the exclusive or.
hashCode
in interface Map.Entry
public String toString()
Convert this pair to a String
. The returned string is of
the form key=value
where key
and
value
are the entries in this pair, converted to
String
.
key=value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |