Interface Maps.EntryTransformer<K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object>

Type Parameters:
K - the key type of the input and output entries
V1 - the value type of the input entry
V2 - the value type of the output entry
Enclosing class:
Maps

public static interface Maps.EntryTransformer<K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object>
A transformation of the value of a key-value pair, using both key and value as inputs. To apply the transformation to a map, use Maps.transformEntries(Map, EntryTransformer).
Since:
7.0
Author:
Kevin Bourrillion, Mike Bostock, Isaac Shum, Louis Wasserman
  • Method Summary

    Modifier and Type
    Method
    Description
    transformEntry(K key, V1 value)
    Determines an output value based on a key-value pair.
  • Method Details

    • transformEntry

      V2 transformEntry(K key, V1 value)
      Determines an output value based on a key-value pair. This method is generally expected, but not absolutely required, to have the following properties:
      • Its execution does not cause any observable side effects.
      • The computation is consistent with equals; that is,
        invalid reference
        Objects.equal
        (k1, k2) &&
        invalid reference
        Objects#equal
        (v1, v2) implies that Objects.equals(transformer.transform(k1, v1), transformer.transform(k2, v2)).
      Throws:
      NullPointerException - if the key or value is null and this transformer does not accept null arguments