Package jline.util

Class Triple<A,B,C>

java.lang.Object
jline.util.Triple<A,B,C>
Type Parameters:
A - the type of the first element
B - the type of the second element
C - the type of the third element
All Implemented Interfaces:
Serializable

public class Triple<A,B,C> extends Object implements Serializable
A generic triple container that holds three objects of potentially different types.

This utility class provides a simple way to group three related values together. It implements Serializable for persistence. It is the three-element counterpart of Pair and exposes the same Kotlin-style accessors (getFirst(), getSecond(), getThird()) so that code previously written against kotlin.Triple works unchanged.

Common use cases:

  • Returning three values from methods
  • Temporary grouping of related objects

Since:
1.0
See Also:
  • Constructor Details

    • Triple

      public Triple(A first, B second, C third)
      Constructs a new triple with the specified elements.
      Parameters:
      first - the first element of the triple
      second - the second element of the triple
      third - the third element of the triple
    • Triple

      public Triple(Triple<A,B,C> other)
      Copy constructor that creates a new triple with the same elements as another triple.
      Parameters:
      other - the triple to copy from
  • Method Details

    • getFirst

      public A getFirst()
    • setFirst

      public void setFirst(A first)
    • getSecond

      public B getSecond()
    • setSecond

      public void setSecond(B second)
    • getThird

      public C getThird()
    • setThird

      public void setThird(C third)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object