Class Pair<L,​R>

java.lang.Object
wtf.choco.veinminer.utils.Pair<L,​R>
Type Parameters:
L - the type of object on the left
R - the type of object on the right

public class Pair<L,​R>
extends Object
Represents a pair of two (potentially null) objects.
Author:
Parker Hawke - Choco
  • Constructor Summary

    Constructors 
    Constructor Description
    Pair​(L left, R right)
    Construct a new pair of objects.
  • Method Summary

    Modifier and Type Method Description
    static <L,​ R> @NotNull Pair<L,​R> empty()
    Get an empty pair.
    L getLeft()
    Get the object on the left.
    R getRight()
    Get the object on the right.
    boolean isEmpty()
    Check whether or not this pair is empty.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pair

      public Pair​(@Nullable L left, @Nullable R right)
      Construct a new pair of objects.
      Parameters:
      left - the left object
      right - the right object
  • Method Details

    • getLeft

      @Nullable public L getLeft()
      Get the object on the left.
      Returns:
      the left object. null if none
    • getRight

      @Nullable public R getRight()
      Get the object on the right.
      Returns:
      the right object. null if none
    • isEmpty

      public boolean isEmpty()
      Check whether or not this pair is empty. A pair is empty if both elements are null.
      Returns:
      true if empty, false otherwise
    • empty

      @NotNull public static <L,​ R> @NotNull Pair<L,​R> empty()
      Get an empty pair.
      Type Parameters:
      L - the type of object on the left
      R - the type of object on the right
      Returns:
      an empty pair