Interface MapEntry<K,V>

Type Parameters:
K - key type
V - value type
All Superinterfaces:
Map.Entry<K,V>, Serializable
All Known Implementing Classes:
MapEntry.SimpleMapEntry

public interface MapEntry<K,V> extends Map.Entry<K,V>, Serializable
An immutable map entry. This implementation differs from Map.entry(Object, Object) in the following ways:
  • Supports null key or value
  • Supports mapping operation
Author:
Paul Ferraro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    A simple map entry implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <KK,VV> MapEntry<KK,VV>
    map(Function<K,KK> keyMapper, Function<V,VV> valueMapper)
    Returns a new map entry whose key/value are generated by applying the specified mapping functions.
    static <K,V> MapEntry<K,V>
    of(K key, V value)
    Returns a new immutable map entry from the specified key and value.
    default V
    setValue(V value)
     

    Methods inherited from interface Map.Entry

    equals, getKey, getValue, hashCode
  • Method Details

    • map

      default <KK,VV> MapEntry<KK,VV> map(Function<K,KK> keyMapper, Function<V,VV> valueMapper)
      Returns a new map entry whose key/value are generated by applying the specified mapping functions.
      Type Parameters:
      KK - the mapped key type
      VV - the mapped value type
      Parameters:
      keyMapper - a key mapper
      valueMapper - a value mapper
      Returns:
      a new map entry
    • setValue

      default V setValue(V value)
      Specified by:
      setValue in interface Map.Entry<K,V>
    • of

      static <K,V> MapEntry<K,V> of(K key, V value)
      Returns a new immutable map entry from the specified key and value.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      key - the map entry key
      value - the map entry value
      Returns:
      a new map entry