Class Pair<T,​U>

Object
AbstractPair<T,​U>
Pair<T,​U>

public class Pair<T,​U>
extends AbstractPair<T,​U>
  • Constructor Summary

    Constructors 
    Constructor Description
    Pair​(Map.Entry<T,​U> entry)
    Creates a pair using a map entry
    Pair​(AbstractPair<T,​U> pair)
    Creates a pair using another pair
    Pair​(T first, U second)
    Creates a 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

    Methods inherited from class AbstractPair

    toString

    Methods inherited from class Object

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

    • Pair

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

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

      public Pair​(Map.Entry<T,​U> entry)
      Creates a 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