Class Pair<L,R>

java.lang.Object
com.github.tadukoo.util.tuple.Pair<L,R>
Type Parameters:
L - The left item type
R - The right item type

public class Pair<L,R> extends Object
A tuple class for holding 2 items of specified type.
Version:
0.1-Alpha-SNAPSHOT
Author:
Logan Ferree (Tadukoo)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private L
    The left item in the tuple
    private R
    The right item in the tuple
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Pair(L left, R right)
    Constructs a Pair of the two given objects.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
     
    static <L, R> Pair<L,R>
    of(L left, R right)
    Constructs a Pair of the two given objects.
    void
    setKey(L key)
    Sets the left item (key) of the Pair
    void
    setLeft(L left)
    Sets the left item of the Pair
    void
    setRight(R right)
    Sets the right item of the Pair
    void
    setValue(R value)
    Sets the right item (value) of the Pair
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • left

      private L left
      The left item in the tuple
  • Constructor Details

    • Pair

      private Pair(L left, R right)
      Constructs a Pair of the two given objects.
      Parameters:
      left - The left item in the pair
      right - The right item in the pair
  • Method Details

    • of

      public static <L, R> Pair<L,R> of(L left, R right)
      Constructs a Pair of the two given objects.
      Type Parameters:
      L - The type of the left item
      R - The type of the right item
      Parameters:
      left - The left item in the Pair
      right - The right item in the Pair
      Returns:
      A Pair containing the two given items
    • getLeft

      public L getLeft()
      Returns:
      The left item from the Pair
    • getKey

      public L getKey()
      Returns:
      The left item (key) from the Pair
    • setLeft

      public void setLeft(L left)
      Sets the left item of the Pair
      Parameters:
      left - The left item to set
    • setKey

      public void setKey(L key)
      Sets the left item (key) of the Pair
      Parameters:
      key - The left item (key) to set
    • getRight

      public R getRight()
      Returns:
      The right item of the Pair
    • getValue

      public R getValue()
      Returns:
      The right item (value) of the Pair
    • setRight

      public void setRight(R right)
      Sets the right item of the Pair
      Parameters:
      right - The right item to set
    • setValue

      public void setValue(R value)
      Sets the right item (value) of the Pair
      Parameters:
      value - The right item (value) to set
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      A string representation of the Pair as ({left item}, {right item})