Class Pair<L,R>

java.lang.Object
org.graalvm.collections.Pair<L,R>

public final class Pair<L,R> extends Object
Utility class representing a pair of values.
Since:
19.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static <L, R> Pair<L,R>
    create(L left, R right)
    Constructs a pair with its left value being left, and its right value being right, or returns an empty pair if both inputs are null.
    static <L, R> Pair<L,R>
    createLeft(L left)
    Constructs a pair with its left value being left, or returns an empty pair if left is null.
    static <L, R> Pair<L,R>
    createRight(R right)
    Constructs a pair with its right value being right, or returns an empty pair if right is null.
    static <L, R> Pair<L,R>
    Returns an empty pair.
    boolean
    Returns the left value of this pair.
    Returns the right value of this pair.
    int

    Methods inherited from class java.lang.Object

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

    • empty

      public static <L, R> Pair<L,R> empty()
      Returns an empty pair.
      Since:
      19.0
    • createLeft

      public static <L, R> Pair<L,R> createLeft(L left)
      Constructs a pair with its left value being left, or returns an empty pair if left is null.
      Returns:
      the constructed pair or an empty pair if left is null.
      Since:
      19.0
    • createRight

      public static <L, R> Pair<L,R> createRight(R right)
      Constructs a pair with its right value being right, or returns an empty pair if right is null.
      Returns:
      the constructed pair or an empty pair if right is null.
      Since:
      19.0
    • create

      public static <L, R> Pair<L,R> create(L left, R right)
      Constructs a pair with its left value being left, and its right value being right, or returns an empty pair if both inputs are null.
      Returns:
      the constructed pair or an empty pair if both inputs are null.
      Since:
      19.0
    • getLeft

      public L getLeft()
      Returns the left value of this pair.
      Since:
      19.0
    • getRight

      public R getRight()
      Returns the right value of this pair.
      Since:
      19.0
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Since:
      19.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      19.0