Class Pair<T,U>

java.lang.Object
ortus.boxlang.runtime.util.Pair<T,U>
Type Parameters:
T - The type of the first element
U - The type of the second element

public class Pair<T,U> extends Object
A simple immutable pair class for holding two related objects.

This is a utility class used throughout BoxLang for returning or storing two values together. The pair is typed, and both elements can be of any type.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(T first, U second)
    Constructs a new immutable Pair with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the first value in the pair.
    Returns the second value in the pair.
    Returns a string representation of the pair in the form (first, second).

    Methods inherited from class java.lang.Object

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

    • Pair

      public Pair(T first, U second)
      Constructs a new immutable Pair with the given values.
      Parameters:
      first - The first value
      second - The second value
  • Method Details

    • getFirst

      public T getFirst()
      Returns the first value in the pair.
      Returns:
      The first value
    • getSecond

      public U getSecond()
      Returns the second value in the pair.
      Returns:
      The second value
    • toString

      public String toString()
      Returns a string representation of the pair in the form (first, second).
      Overrides:
      toString in class Object
      Returns:
      String representation of the pair