Record Class Pair<T,U>

java.lang.Object
java.lang.Record
io.github.syst3ms.skriptparser.util.Pair<T,U>
Type Parameters:
T - type of the first value
U - type of the second value

public record Pair<T,U>(T getFirst, U getSecond) extends Record
A simple pair of two values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(T getFirst, U getSecond)
    Creates an instance of a Pair record class.
  • Method Summary

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

    Methods inherited from class Object

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

    • Pair

      public Pair(T getFirst, U getSecond)
      Creates an instance of a Pair record class.
      Parameters:
      getFirst - the value for the getFirst record component
      getSecond - the value for the getSecond record component
  • Method Details

    • getFirst

      public T getFirst()
      Retrieves the first element
      Returns:
      the first element
    • getSecond

      public U getSecond()
      Retrieves the second element
      Returns:
      the second element
    • equals

      public 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.
    • 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