org.javimmutable.collections
Class MapEntry<K,V>
java.lang.Object
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.
key
protected final K key
value
protected final V value
MapEntry
public MapEntry(Map.Entry<K,V> entry)
MapEntry
public MapEntry(JImmutableMap.Entry<K,V> entry)
MapEntry
public MapEntry(K key,
V value)
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.