Class Pair<A,​B>

java.lang.Object
VASSAL.tools.lang.Pair<A,​B>
Type Parameters:
A - the type of the first object
B - the type of the second object

public final class Pair<A,​B> extends Object
An immutable class for pairs of objects.
Since:
3.2.0
Author:
Joel Uckelman
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair​(A first, B second)
    Creates a pair with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(Object o)
    int
    static <A,​ B> Pair<A,​B>
    of​(A first, B second)
    A convenience method for creating pairs without specifying the types.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • first

      public final A first
    • second

      public final B second
  • Constructor Details

    • Pair

      public Pair(A first, B second)
      Creates a pair with the given values.
      Parameters:
      first - the first value
      second - the second value
  • Method Details

    • hashCode

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

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

      public static <A,​ B> Pair<A,​B> of(A first, B second)
      A convenience method for creating pairs without specifying the types.
      Parameters:
      first - the first value
      second - the second value
      Returns:
      the pair containing first and (@code second}