Interface EntryTransformer<K,V1,V2>

Type Parameters:
K - key type | 键类型
V1 - input value type | 输入值类型
V2 - output value type | 输出值类型
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface EntryTransformer<K,V1,V2>
EntryTransformer - Function to transform map entries EntryTransformer - 转换 Map 条目的函数

A functional interface for transforming a key-value pair into a new value. Used in MapUtil.transformEntries(Map, MapUtil.EntryTransformer).

将键值对转换为新值的函数式接口。 用于 MapUtil.transformEntries(Map, MapUtil.EntryTransformer)

Features | 主要功能:

  • Transform map entries based on key and value - 根据键和值转换 Map 条目
  • Functional interface for lambda usage - 函数式接口支持 Lambda

Usage Examples | 使用示例:

// Transform values using both key and value - 使用键和值转换值
EntryTransformer<String, Integer, String> transformer =
    (key, value) -> key + "=" + value;

Map<String, String> transformed = MapUtil.transformEntries(map, transformer);

Performance | 性能特性:

  • Transform: depends on implementation - 转换: 取决于实现

Security | 安全性:

  • Thread-safe: depends on implementation - 线程安全: 取决于实现
  • Null-safe: depends on implementation - 空值安全: 取决于实现
Since:
JDK 25, opencode-base-collections V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    transformEntry(K key, V1 value)
    Transform a key-value entry into a new value.
  • Method Details

    • transformEntry

      V2 transformEntry(K key, V1 value)
      Transform a key-value entry into a new value. 将键值条目转换为新值。
      Parameters:
      key - the key | 键
      value - the value | 值
      Returns:
      the transformed value | 转换后的值