Class Tuple2<T1,T2>

java.lang.Object
org.seasar.doma.jdbc.criteria.tuple.Tuple2<T1,T2>
Type Parameters:
T1 - the type of the first element
T2 - the type of the second element

public final class Tuple2<T1,T2> extends Object
A tuple class that holds two elements of potentially different types.

This class is used in the criteria API to represent pairs of values returned from database queries, allowing for type-safe access to multiple columns in query results.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Tuple2(T1 item1, T2 item2)
    Constructs a new tuple with the specified elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the first element of this tuple.
    Returns the second element of this tuple.
    boolean
    Compares this tuple with the specified object for equality.
    Returns the first element of this tuple.
    Returns the second element of this tuple.
    int
    Returns the hash code value for this tuple.
    Returns a string representation of this tuple.

    Methods inherited from class java.lang.Object

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

    • Tuple2

      public Tuple2(T1 item1, T2 item2)
      Constructs a new tuple with the specified elements.
      Parameters:
      item1 - the first element
      item2 - the second element
  • Method Details

    • getItem1

      public T1 getItem1()
      Returns the first element of this tuple.
      Returns:
      the first element
    • getItem2

      public T2 getItem2()
      Returns the second element of this tuple.
      Returns:
      the second element
    • component1

      public T1 component1()
      Returns the first element of this tuple.

      This method provides Kotlin-style component access.

      Returns:
      the first element
    • component2

      public T2 component2()
      Returns the second element of this tuple.

      This method provides Kotlin-style component access.

      Returns:
      the second element
    • equals

      public boolean equals(Object o)
      Compares this tuple with the specified object for equality.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code value for this tuple.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value
    • toString

      public String toString()
      Returns a string representation of this tuple.
      Overrides:
      toString in class Object
      Returns:
      a string representation