org.apache.avro.util

## Class MapEntry<K,V>

- java.lang.Object
- - org.apache.avro.util.MapEntry<K,V>

- Type Parameters:
    `K` - Key of the map-entry
    `V` - Value of the map-entry
  All Implemented Interfaces:
    Map.Entry<K,V>

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

  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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapEntry(K key, V value)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `K` | `getKey()`
    `V` | `getValue()`
    `V` | `setValue(V value)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map.Entry

      `comparingByKey, comparingByKey, comparingByValue, comparingByValue, equals, hashCode`

- - ### Constructor Detail

    - #### MapEntry

          public MapEntry(K key,
                          V value)

  - ### Method Detail

    - #### getKey

          public K getKey()

      Specified by:
        `getKey` in interface `Map.Entry<K,V>`

    - #### getValue

          public V getValue()

      Specified by:
        `getValue` in interface `Map.Entry<K,V>`

    - #### setValue

          public V setValue(V value)

      Specified by:
        `setValue` in interface `Map.Entry<K,V>`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.