Interface KeyValueMapper<K,​V,​VR>

Type Parameters:
K - key type
V - value type
VR - mapped value type

public interface KeyValueMapper<K,​V,​VR>
The KeyValueMapper interface for mapping a key-value pair to a new value of arbitrary type. For example, it can be used to
  • map from an input KeyValue pair to an output KeyValue pair with different key and/or value type (for this case output type VR == KeyValue<NewKeyType,NewValueType>)
  • map from an input record to a new key (with arbitrary key type as specified by VR)
This is a stateless record-by-record operation, i.e, apply(Object, Object) is invoked individually for each record of a stream (cf. Transformer for stateful record transformation). KeyValueMapper is a generalization of ValueMapper.
See Also:
ValueMapper, Transformer, KStream.map(KeyValueMapper), KStream.flatMap(KeyValueMapper), KStream.selectKey(KeyValueMapper), KStream.groupBy(KeyValueMapper), KStream.groupBy(KeyValueMapper, Grouped), KTable.groupBy(KeyValueMapper), KTable.groupBy(KeyValueMapper, Grouped), KTable.toStream(KeyValueMapper)
  • Method Summary

    Modifier and Type Method Description
    VR apply​(K key, V value)
    Map a record with the given key and value to a new value.
  • Method Details

    • apply

      VR apply​(K key, V value)
      Map a record with the given key and value to a new value.
      Parameters:
      key - the key of the record
      value - the value of the record
      Returns:
      the new value