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

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

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

An Entry maintaining an immutable key and value. This class does not support method setValue. This class may be convenient in methods that return thread-safe snapshots of key-value mappings.

Since:
1.6
See Also:
Serialized Form

Constructor Summary
AbstractMapPro.SimpleImmutableEntry(K key, V value)
          Creates an entry representing a mapping from the specified key to the specified value.
AbstractMapPro.SimpleImmutableEntry(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 (optional operation).
 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.SimpleImmutableEntry

public AbstractMapPro.SimpleImmutableEntry(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.SimpleImmutableEntry

public AbstractMapPro.SimpleImmutableEntry(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 (optional operation). This implementation simply throws UnsupportedOperationException, as this class implements an immutable map entry.

Specified by:
setValue in interface Map.Entry<K,V>
Parameters:
value - new value to be stored in this entry
Returns:
(Does not return)
Throws:
UnsupportedOperationException - always

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