org.javimmutable.collections
Class MapEntry<K,V>

java.lang.Object
  extended by org.javimmutable.collections.MapEntry<K,V>
Type Parameters:
K -
V -
All Implemented Interfaces:
Map.Entry<K,V>, JImmutableMap.Entry<K,V>

@Immutable
public class MapEntry<K,V>
extends Object
implements JImmutableMap.Entry<K,V>, Map.Entry<K,V>

Immutable implementation of both Map.Entry and PersistentMap.Entry that uses the same equals() and hashCode() implementations as documented in javadoc for Map.Entry.


Field Summary
protected  K key
           
protected  V value
           
 
Constructor Summary
MapEntry(JImmutableMap.Entry<K,V> entry)
           
MapEntry(K key, V value)
           
MapEntry(Map.Entry<K,V> entry)
           
 
Method Summary
static void addToString(StringBuilder sb, JImmutableMap.Entry entry)
           
 boolean equals(Object o)
           
 K getKey()
           
 V getValue()
           
 int hashCode()
           
static String makeToString(JImmutableMap.Entry entry)
           
static
<K,V> MapEntry<K,V>
of(JImmutableMap.Entry<K,V> entry)
           
static
<K,V> MapEntry<K,V>
of(K key, V value)
           
static
<K,V> MapEntry<K,V>
of(Map.Entry<K,V> entry)
           
 V setValue(V v)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected final K key

value

protected final V value
Constructor Detail

MapEntry

public MapEntry(Map.Entry<K,V> entry)

MapEntry

public MapEntry(JImmutableMap.Entry<K,V> entry)

MapEntry

public MapEntry(K key,
                V value)
Method Detail

of

@Nonnull
public static <K,V> MapEntry<K,V> of(Map.Entry<K,V> entry)

of

@Nonnull
public static <K,V> MapEntry<K,V> of(JImmutableMap.Entry<K,V> entry)

of

@Nonnull
public static <K,V> MapEntry<K,V> of(K key,
                                             V value)

getKey

@Nonnull
public K getKey()
Specified by:
getKey in interface Map.Entry<K,V>
Specified by:
getKey in interface JImmutableMap.Entry<K,V>

getValue

public V getValue()
Specified by:
getValue in interface Map.Entry<K,V>
Specified by:
getValue in interface JImmutableMap.Entry<K,V>

setValue

public V setValue(V v)
Specified by:
setValue in interface Map.Entry<K,V>

hashCode

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

equals

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

toString

public String toString()
Overrides:
toString in class Object

makeToString

public static String makeToString(JImmutableMap.Entry entry)

addToString

public static void addToString(StringBuilder sb,
                               JImmutableMap.Entry entry)


Copyright © 2014 Burton Computer Corporation. All rights reserved.