public class MapEntry
extends java.lang.Object
implements java.util.Map.Entry
Map.Entry implementation that can be constructed to either be read-only or not.
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
key
The entry key.
|
private boolean |
modifiable
Whether the entry can be modified.
|
private java.lang.Object |
value
The entry value.
|
Constructor and Description |
---|
MapEntry(java.lang.Object key,
java.lang.Object value,
boolean modifiable)
Creates a map entry that can either allow modifications or not.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Determines if this entry is equal to the passed object.
|
java.lang.Object |
getKey()
Gets the entry key.
|
java.lang.Object |
getValue()
Gets the entry value.
|
int |
hashCode()
Returns the hashcode for this entry.
|
java.lang.Object |
setValue(java.lang.Object val)
Sets the entry value if the entry can be modified.
|
private java.lang.Object key
The entry key.
private java.lang.Object value
The entry value.
private boolean modifiable
Whether the entry can be modified.
public MapEntry(java.lang.Object key, java.lang.Object value, boolean modifiable)
Creates a map entry that can either allow modifications or not.
key
- The entry keyvalue
- The entry valuemodifiable
- Whether the entry should allow modification or notpublic java.lang.Object getKey()
Gets the entry key.
getKey
in interface java.util.Map.Entry
public java.lang.Object getValue()
Gets the entry value.
getValue
in interface java.util.Map.Entry
public java.lang.Object setValue(java.lang.Object val)
Sets the entry value if the entry can be modified.
setValue
in interface java.util.Map.Entry
val
- The new valuejava.lang.UnsupportedOperationException
- If the entry cannot be modifiedpublic boolean equals(java.lang.Object o)
Determines if this entry is equal to the passed object.
equals
in interface java.util.Map.Entry
equals
in class java.lang.Object
o
- The object to testpublic int hashCode()
Returns the hashcode for this entry.
hashCode
in interface java.util.Map.Entry
hashCode
in class java.lang.Object