Class Pair<F extends java.io.Serializable,​S extends java.io.Serializable>

  • Type Parameters:
    F - the type of the first object, which must be Serializable
    S - the type of the second object, which must be Serializable
    All Implemented Interfaces:
    java.io.Serializable

    public class Pair<F extends java.io.Serializable,​S extends java.io.Serializable>
    extends java.lang.Object
    implements java.io.Serializable
    Serializable class to create a pair of objects.

    The two objects of the pair must be serializable and can be of the same type.

    Note that this class is not intended to be used as a general-purpose pair and should only be used when interfacing with the extractor.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(F first, S second)
      Creates a new Pair object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Reveals whether an object is equal to this Pair instance.
      F getFirst()
      Gets the first object of the pair.
      S getSecond()
      Gets the second object of the pair.
      int hashCode()
      Returns a hash code of the current Pair by using the first and second object.
      void setFirst​(F first)
      Sets the first object, which must be of the Pair type.
      void setSecond​(S second)
      Sets the first object, which must be of the Pair type.
      java.lang.String toString()
      Returns a string representation of the current Pair.
      • Methods inherited from class java.lang.Object

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

      • Pair

        public Pair​(F first,
                    S second)
        Creates a new Pair object.
        Parameters:
        first - the first object of the pair
        second - the second object of the pair
    • Method Detail

      • setFirst

        public void setFirst​(F first)
        Sets the first object, which must be of the Pair type.
        Parameters:
        first - the new first object of the pair
      • setSecond

        public void setSecond​(S second)
        Sets the first object, which must be of the Pair type.
        Parameters:
        second - the new first object of the pair
      • getFirst

        public F getFirst()
        Gets the first object of the pair.
        Returns:
        the first object of the pair
      • getSecond

        public S getSecond()
        Gets the second object of the pair.
        Returns:
        the second object of the pair
      • toString

        public java.lang.String toString()
        Returns a string representation of the current Pair.

        The string representation will look like this: {firstObject.toString(), secondObject.toString()}

        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the current Pair
      • equals

        public boolean equals​(java.lang.Object obj)
        Reveals whether an object is equal to this Pair instance.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare with this Pair instance
        Returns:
        whether an object is equal to this Pair instance
      • hashCode

        public int hashCode()
        Returns a hash code of the current Pair by using the first and second object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code of the current Pair