Top Description Fields Constructors Methods
org.apache.avro.util

public Class MapEntry<K, V>

extends Object
implements Map.Entry<K, V>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry
Type Parameters
<K>
Key of the map-entry
<V>
Value of the map-entry
Imports
java.util.Map

An implementation of Map.Entry with well-defined member names.

Using this class helps make Avro immune from the naming variations of key/value fields among several Map.Entry implementations. If objects of this class are used instead of the regular ones obtained by Map#entrySet(), then we need not worry about the actual field names or any changes to them in the future.

Example: ConcurrentHashMap.MapEntry does not name the fields as key/ value in Java 1.8 while it used to do so in Java 1.7

Field Summary

Modifier and TypeField and Description
pack-priv K
pack-priv V

Constructor Summary

AccessConstructor and Description
public
MapEntry(K key, V value)

Method Summary

Modifier and TypeMethod and Description
public K
getKey()

Implements java.util.Map.Entry.getKey.

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

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public V
setValue(V
new value to be stored in this entry
value
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
pack-priv K key
valueback to summary
pack-priv V value

Constructor Detail

MapEntryback to summary
public MapEntry(K key, V value)

Method Detail

getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:K

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public V getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:V

the value corresponding to this entry

Annotations
@Override
setValueback to summary
public V setValue(V value)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
value:V

new value to be stored in this entry

Returns:V

old value corresponding to the entry

Annotations
@Override