Class Pair<T,U>

java.lang.Object
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
This utility class stores two items together in a pair. It could be used, for instance, to faciliate returning of two values in a function.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(T t, U u)
    Creates a Pair of items.
  • Method Summary

    Modifier and Type
    Method
    Description
    t()
    Returns the first item of the pair.
    Returns the string representation of the pair.
    u()
    Returns the second item of the pair.

    Methods inherited from class java.lang.Object

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

    • Pair

      public Pair(T t, U u)
      Creates a Pair of items.
      Parameters:
      t - first item of the pair
      u - second item of the pair
  • Method Details

    • t

      public T t()
      Returns the first item of the pair.
      Returns:
      the first item of the pair
    • u

      public U u()
      Returns the second item of the pair.
      Returns:
      the second item of the pair
    • toString

      public String toString()
      Returns the string representation of the pair.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the pair