Class MutablePair<T,​U>

Object
AbstractPair<T,​U>
AbstractMutablePair<T,​U>
MutablePair<T,​U>

public class MutablePair<T,​U>
extends AbstractMutablePair<T,​U>
  • Constructor Summary

    Constructors 
    Constructor Description
    MutablePair​(Map.Entry<T,​U> entry)
    Creates a mutable pair using a map entry
    MutablePair​(AbstractPair<T,​U> pair)
    Creates a mutable pair using another pair
    MutablePair​(T first, U second)
    Creates a mutable pair by specifying its values
  • Method Summary

    Modifier and Type Method Description
    T getFirst()
    Returns the value of the first item in the pair
    U getSecond()
    Returns the value of the second item in the pair
    T setFirst​(T first)
    Sets the first item in the pair and returns the old value
    U setSecond​(U second)
    Sets the second item in the pair and returns the old value

    Methods inherited from class AbstractPair

    toString

    Methods inherited from class Object

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

    • MutablePair

      public MutablePair​(T first, U second)
      Creates a mutable pair by specifying its values
      Parameters:
      first - first value in the pair
      second - second value in the pair
    • MutablePair

      public MutablePair​(AbstractPair<T,​U> pair)
      Creates a mutable pair using another pair
      Parameters:
      pair - the pair containing the values to be used
    • MutablePair

      public MutablePair​(Map.Entry<T,​U> entry)
      Creates a mutable pair using a map entry
      Parameters:
      entry - the entry containing the values to be used
  • Method Details

    • getFirst

      public T getFirst()
      Description copied from class: AbstractPair
      Returns the value of the first item in the pair
      Specified by:
      getFirst in class AbstractPair<T,​U>
      Returns:
      the value of the first item in the pair
    • getSecond

      public U getSecond()
      Description copied from class: AbstractPair
      Returns the value of the second item in the pair
      Specified by:
      getSecond in class AbstractPair<T,​U>
      Returns:
      the value of the second item in the pair
    • setFirst

      public T setFirst​(T first)
      Description copied from class: AbstractMutablePair
      Sets the first item in the pair and returns the old value
      Specified by:
      setFirst in class AbstractMutablePair<T,​U>
      Parameters:
      first - the future value of the first item
      Returns:
      the old value of the first item
    • setSecond

      public U setSecond​(U second)
      Description copied from class: AbstractMutablePair
      Sets the second item in the pair and returns the old value
      Specified by:
      setSecond in class AbstractMutablePair<T,​U>
      Parameters:
      second - the future value of the second item
      Returns:
      the old value of the second item