Package org.jboss.msc.value
Class MapEntry<K,V>
- java.lang.Object
-
- org.jboss.msc.value.MapEntry<K,V>
-
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
java.io.Serializable
,java.util.Map.Entry<K,V>
public final class MapEntry<K,V> extends java.lang.Object implements java.util.Map.Entry<K,V>, java.io.Serializable
An immutable key-value object for constructing map instances programmatically.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private K
key
private static long
serialVersionUID
private V
value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
java.util.Map<K,V>addTo(java.util.Map<K,V> map, MapEntry<? extends K,? extends V>... entries)
Add entries to a map.static <K,V>
MapEntry<K,V>entry(K key, V value)
Construct a new instance.boolean
equals(java.lang.Object obj)
Compare this entry with another.boolean
equals(MapEntry<?,?> obj)
Compare this entry with another.K
getKey()
Get the map key.V
getValue()
Get the map value.int
hashCode()
Get the hash code of this object.V
setValue(V value)
Unsupported operation.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
key
private final K key
-
value
private final V value
-
-
Method Detail
-
entry
public static <K,V> MapEntry<K,V> entry(K key, V value)
Construct a new instance.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
key
- the map keyvalue
- the map value- Returns:
- the entry
-
getKey
public K getKey()
Get the map key.
-
getValue
public V getValue()
Get the map value.
-
equals
public boolean equals(java.lang.Object obj)
Compare this entry with another.
-
equals
public boolean equals(MapEntry<?,?> obj)
Compare this entry with another.- Parameters:
obj
- the other entry- Returns:
true
if this object equals the otherMapEntry
instance,false
otherwise
-
hashCode
public int hashCode()
Get the hash code of this object.
-
addTo
public static <K,V> java.util.Map<K,V> addTo(java.util.Map<K,V> map, MapEntry<? extends K,? extends V>... entries)
Add entries to a map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
- the map to add toentries
- the entries to add- Returns:
- the map
-
-