Class MutablePair<L,R>

java.lang.Object
net.dv8tion.jda.internal.utils.tuple.Pair<L,R>
net.dv8tion.jda.internal.utils.tuple.MutablePair<L,R>
Type Parameters:
L - the left element type
R - the right element type
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MutableTriple

public class MutablePair<L,R> extends Pair<L,R>
This class has been copied from Lang 3

A mutable pair consisting of two Object elements.

Not #ThreadSafe#

Since:
Lang 3.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Left object
    Right object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new pair instance of two nulls.
    MutablePair(L left, R right)
    Create a new pair instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the left element from this pair.
    Gets the right element from this pair.
    static <L, R> MutablePair<L,R>
    of(L left, R right)
    Obtains an immutable pair of from two objects inferring the generic types.
    void
    setLeft(L left)
    Sets the left element of the pair.
    void
    setRight(R right)
    Sets the right element of the pair.

    Methods inherited from class net.dv8tion.jda.internal.utils.tuple.Pair

    equals, hashCode, toString

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • left

      public L left
      Left object
  • Constructor Details

    • MutablePair

      public MutablePair()
      Create a new pair instance of two nulls.
    • MutablePair

      public MutablePair(L left, R right)
      Create a new pair instance.
      Parameters:
      left - the left value, may be null
      right - the right value, may be null
  • Method Details

    • of

      public static <L, R> MutablePair<L,R> of(L left, R right)

      Obtains an immutable pair of from two objects inferring the generic types.

      This factory allows the pair to be created using inference to obtain the generic types.

      Type Parameters:
      L - the left element type
      R - the right element type
      Parameters:
      left - the left element, may be null
      right - the right element, may be null
      Returns:
      a pair formed from the two parameters, not null
    • getLeft

      public L getLeft()
      Description copied from class: Pair

      Gets the left element from this pair.

      When treated as a key-value pair, this is the key.

      Specified by:
      getLeft in class Pair<L,R>
      Returns:
      the left element, may be null
    • setLeft

      public void setLeft(L left)
      Sets the left element of the pair.
      Parameters:
      left - the new value of the left element, may be null
    • getRight

      public R getRight()
      Description copied from class: Pair

      Gets the right element from this pair.

      When treated as a key-value pair, this is the value.

      Specified by:
      getRight in class Pair<L,R>
      Returns:
      the right element, may be null
    • setRight

      public void setRight(R right)
      Sets the right element of the pair.
      Parameters:
      right - the new value of the right element, may be null