Class Pair<U,V>

java.lang.Object
cloud.commandframework.types.tuples.Pair<U,V>
Type Parameters:
U - First type
V - Second type
All Implemented Interfaces:
Tuple

public class Pair<U,V> extends Object implements Tuple
Immutable generic 2-tuple
  • Constructor Details

    • Pair

      protected Pair(U first, V second)
  • Method Details

    • of

      public static <U, V> @NonNull Pair<U,V> of(U first, V second)
      Create a new 2-tuple
      Type Parameters:
      U - First type
      V - Second type
      Parameters:
      first - First value
      second - Second value
      Returns:
      Created pair
    • getFirst

      public final U getFirst()
      Get the first value
      Returns:
      First value
    • getSecond

      public final V getSecond()
      Get the second value
      Returns:
      Second value
    • equals

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

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getSize

      public final int getSize()
      Description copied from interface: Tuple
      Get the tuple size
      Specified by:
      getSize in interface Tuple
      Returns:
      Tuple size
    • toArray

      public final @NonNull Object @NonNull [] toArray()
      Description copied from interface: Tuple
      Turn the tuple into a type erased array
      Specified by:
      toArray in interface Tuple
      Returns:
      Created array