Class Pair<A,B>

java.lang.Object
edu.wpi.first.math.Pair<A,B>
Type Parameters:
A - The first object's type.
B - The second object's type.

public class Pair<A,B> extends Object
Represents a pair of two objects.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(A first, B second)
    Constructs a pair.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks equality between this Pair and another object.
    Returns the first object.
    Returns the second object.
    int
     
    static <A, B> Pair<A,B>
    of(A a, B b)
    Returns a pair comprised of the two given objects.
     

    Methods inherited from class java.lang.Object

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

    • Pair

      public Pair(A first, B second)
      Constructs a pair.
      Parameters:
      first - The first object.
      second - The second object.
  • Method Details

    • getFirst

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

      public B getSecond()
      Returns the second object.
      Returns:
      The second object.
    • of

      public static <A, B> Pair<A,B> of(A a, B b)
      Returns a pair comprised of the two given objects.
      Type Parameters:
      A - The first object's type.
      B - The second object's type.
      Parameters:
      a - The first object.
      b - The second object.
      Returns:
      A pair comprised of the two given objects.
    • toString

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

      public boolean equals(Object obj)
      Checks equality between this Pair and another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The other object.
      Returns:
      Whether the two objects are equal or not.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object