Record Class ValueDifference.ValueDifferenceImpl<V>

java.lang.Object
java.lang.Record
cloud.opencode.base.collections.ValueDifference.ValueDifferenceImpl<V>
Type Parameters:
V - value type | 值类型
All Implemented Interfaces:
ValueDifference<V>
Enclosing interface:
ValueDifference<V>

public static record ValueDifference.ValueDifferenceImpl<V>(V leftValue, V rightValue) extends Record implements ValueDifference<V>
Default implementation of ValueDifference. ValueDifference 的默认实现。
Since:
JDK 25, opencode-base-collections V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • ValueDifferenceImpl

      public ValueDifferenceImpl(V leftValue, V rightValue)
      Creates an instance of a ValueDifferenceImpl record class.
      Parameters:
      leftValue - the value for the leftValue record component
      rightValue - the value for the rightValue record component
  • Method Details

    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • leftValue

      public V leftValue()
      Returns the value of the leftValue record component.
      Specified by:
      leftValue in interface ValueDifference<V>
      Returns:
      the value of the leftValue record component
    • rightValue

      public V rightValue()
      Returns the value of the rightValue record component.
      Specified by:
      rightValue in interface ValueDifference<V>
      Returns:
      the value of the rightValue record component