Class Pair<F,​S>


  • public class Pair<F,​S>
    extends java.lang.Object
    Pair is a container for a pair of values, which may be of different types (F and S). The individual values can be accessed through its public methods.
    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Liangpeng Guo
    Pt.AcceptedRating:
    Red (glp)
    Pt.ProposedRating:
    Red (glp)
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(F first, S second)
      Constructs a Pair with two values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      F getFirst()
      Gets the first element.
      S getSecond()
      Gets the second element.
      void setFirst​(F first)
      Sets the first element.
      void setSecond​(S second)
      Sets the second element.
      java.lang.String toString()
      Converts to a string.
      • Methods inherited from class java.lang.Object

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

      • Pair

        public Pair​(F first,
                    S second)
        Constructs a Pair with two values.
        Parameters:
        first - First value
        second - Second value
    • Method Detail

      • setFirst

        public void setFirst​(F first)
        Sets the first element.
        Parameters:
        first - Value to be assigned to the first element.
        See Also:
        getFirst()
      • setSecond

        public void setSecond​(S second)
        Sets the second element.
        Parameters:
        second - Value to be assigned to the second element.
        See Also:
        getSecond()
      • toString

        public java.lang.String toString()
        Converts to a string.
        Overrides:
        toString in class java.lang.Object
      • getFirst

        public F getFirst()
        Gets the first element.
        Returns:
        The first element in the pair.
        See Also:
        setFirst(F)
      • getSecond

        public S getSecond()
        Gets the second element.
        Returns:
        The second element in the pair.
        See Also:
        setSecond(S)