Class Pair<T,U>

java.lang.Object
com.yetnt.utils.tuple.Pair<T,U>
Type Parameters:
T - The type of the first object.
U - The type of the second object.
Direct Known Subclasses:
SamePair

public class Pair<T,U> extends Object
A generic Pair class that holds two related objects.

From Jaiva!

Author:
Lehlogonolo Poole
See Also:
  • Field Details

    • first

      protected final T first
      The first object in the pair.
    • second

      protected final U second
      The second object in the pair.
  • Constructor Details

    • Pair

      public Pair(T first, U second)
      Constructs a Pair with the specified objects.
      Parameters:
      first - The first object.
      second - The second object.
    • Pair

      public Pair(MutablePair<T,U> pair)
      Creates an immutable Pair from a MutablePair instance by fetching it's values.
      Parameters:
      pair - The mutable pair
  • Method Details

    • getFirst

      public T getFirst()
      Returns the first object
      Returns:
      The first object
    • getSecond

      public U getSecond()
      Returns the second object
      Returns:
      The second object
    • equals

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object