Interface ValueDifference<V>
- Type Parameters:
V- value type | 值类型
- All Known Implementing Classes:
ValueDifference.ValueDifferenceImpl
public interface ValueDifference<V>
ValueDifference - Represents a difference between two values
ValueDifference - 表示两个值之间的差异
Used in MapDifference to represent the difference between
values in two maps for the same key.
用于 MapDifference 中表示相同键在两个 Map 中值的差异。
Features | 主要功能:
- Store left and right values - 存储左值和右值
- Factory method for creation - 工厂方法创建
- Equality and hash code support - 支持相等性和哈希码
Usage Examples | 使用示例:
ValueDifference<Integer> diff = ValueDifference.create(100, 200);
Integer left = diff.leftValue(); // 100
Integer right = diff.rightValue(); // 200
Performance | 性能特性:
- All operations: O(1) - 所有操作: O(1)
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: Yes (allows null values) - 空值安全: 是(允许空值)
- Since:
- JDK 25, opencode-base-collections V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordDefault implementation of ValueDifference. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> ValueDifference<V> create(V left, V right) Create a new ValueDifference.Get the value from the left map.Get the value from the right map.
-
Method Details
-
leftValue
-
rightValue
-
create
Create a new ValueDifference. 创建新的 ValueDifference。- Type Parameters:
V- value type | 值类型- Parameters:
left- the left value | 左值right- the right value | 右值- Returns:
- the value difference | 值差异
-