railo.commons.util.mod
Class AbstractMapPro.SimpleEntry<K,V>

java.lang.Object
  extended by railo.commons.util.mod.AbstractMapPro.SimpleEntry<K,V>
All Implemented Interfaces:
Serializable, Map.Entry<K,V>
Enclosing class:
AbstractMapPro<K,V>

public static class AbstractMapPro.SimpleEntry<K,V>
extends Object
implements Map.Entry<K,V>, Serializable

An Entry maintaining a key and a value. The value may be changed using the setValue method. This class facilitates the process of building custom map implementations. For example, it may be convenient to return arrays of SimpleEntry instances in method Map.entrySet().toArray.

Since:
1.6
See Also:
Serialized Form

Constructor Summary
AbstractMapPro.SimpleEntry(K key, V value)
          Creates an entry representing a mapping from the specified key to the specified value.
AbstractMapPro.SimpleEntry(Map.Entry<? extends K,? extends V> entry)
          Creates an entry representing the same mapping as the specified entry.
 
Method Summary
 boolean equals(Object o)
           
 K getKey()
          Returns the key corresponding to this entry.
 V getValue()
          Returns the value corresponding to this entry.
 int hashCode()
           
 V setValue(V value)
          Replaces the value corresponding to this entry with the specified value.
 String toString()
          Returns a String representation of this map entry.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMapPro.SimpleEntry

public AbstractMapPro.SimpleEntry(K key,
                                  V value)
Creates an entry representing a mapping from the specified key to the specified value.

Parameters:
key - the key represented by this entry
value - the value represented by this entry

AbstractMapPro.SimpleEntry

public AbstractMapPro.SimpleEntry(Map.Entry<? extends K,? extends V> entry)
Creates an entry representing the same mapping as the specified entry.

Parameters:
entry - the entry to copy
Method Detail

getKey

public K getKey()
Returns the key corresponding to this entry.

Specified by:
getKey in interface Map.Entry<K,V>
Returns:
the key corresponding to this entry

getValue

public V getValue()
Returns the value corresponding to this entry.

Specified by:
getValue in interface Map.Entry<K,V>
Returns:
the value corresponding to this entry

setValue

public V setValue(V value)
Replaces the value corresponding to this entry with the specified value.

Specified by:
setValue in interface Map.Entry<K,V>
Parameters:
value - new value to be stored in this entry
Returns:
the old value corresponding to the entry

equals

public boolean equals(Object o)
Specified by:
equals in interface Map.Entry<K,V>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map.Entry<K,V>
Overrides:
hashCode in class Object

toString

public String toString()
Returns a String representation of this map entry. This implementation returns the string representation of this entry's key followed by the equals character ("=") followed by the string representation of this entry's value.

Overrides:
toString in class Object
Returns:
a String representation of this map entry


Copyright © 2012 Railo