Record Class Triple<V1,V2,V3>

java.lang.Object
java.lang.Record
org.jgroups.util.Triple<V1,V2,V3>
Type Parameters:
V1 - V1
V2 - V2
V3 - V3
Record Components:
val1 - val1
val2 - val2
val3 - val3

public record Triple<V1,V2,V3>(V1 val1, V2 val2, V3 val3) extends Record
Holds 3 values, useful when we have a map with a key, but more than 1 value and we don't want to create a separate holder object for the values, and don't want to pass the values as a list or array.
Author:
Bela Ban
  • Constructor Summary

    Constructors
    Constructor
    Description
    Triple(V1 val1, V2 val2, V3 val3)
    Creates an instance of a Triple record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    Returns the value of the val1 record component.
    Returns the value of the val2 record component.
    Returns the value of the val3 record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Triple

      public Triple(V1 val1, V2 val2, V3 val3)
      Creates an instance of a Triple record class.
      Parameters:
      val1 - the value for the val1 record component
      val2 - the value for the val2 record component
      val3 - the value for the val3 record component
  • Method Details

    • toString

      public final 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
    • hashCode

      public final 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
    • equals

      public final boolean equals(Object o)
      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:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • val1

      public V1 val1()
      Returns the value of the val1 record component.
      Returns:
      the value of the val1 record component
    • val2

      public V2 val2()
      Returns the value of the val2 record component.
      Returns:
      the value of the val2 record component
    • val3

      public V3 val3()
      Returns the value of the val3 record component.
      Returns:
      the value of the val3 record component