Package blbutil

Class Pair<F,​S>

  • Type Parameters:
    F - the type of the first object in the pair.
    S - the type of the second object in the pair.

    public final class Pair<F,​S>
    extends java.lang.Object
    Class Pair represents a pair of ordered objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(F first, S second)
      Constructs a Pair instance representing the specified ordered pair of objects.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Returns true if the specified object is a Pair instance representing the same ordered pair of objects as this, and returns false otherwise.
      F first()
      Returns the first object in the ordered pair of objects.
      int hashCode()
      Returns a hash code value for the object.
      S second()
      Returns the second object in the ordered pair of objects.
      java.lang.String toString()
      Returns a string representation of this.
      • Methods inherited from class java.lang.Object

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

      • Pair

        public Pair​(F first,
                    S second)
        Constructs a Pair instance representing the specified ordered pair of objects.
        Parameters:
        first - the first object in the ordered pair of objects.
        second - the second object in the ordered pair of objects.
        Throws:
        java.lang.NullPointerException - if first==null || second==null.
    • Method Detail

      • first

        public F first()
        Returns the first object in the ordered pair of objects.
        Returns:
        the first object in the ordered pair of objects.
      • second

        public S second()
        Returns the second object in the ordered pair of objects.
        Returns:
        the second object in the ordered pair of objects.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for the object.
      • equals

        public boolean equals​(java.lang.Object obj)
        Returns true if the specified object is a Pair instance representing the same ordered pair of objects as this, and returns false otherwise. Two ordered pairs, p1 and p2, are equal if p1.first().equals(p2.first()) && p1.second().equals(p2.second()).
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to be compared with this for equality.
        Returns:
        true if the specified object is a Pair instance representing the same ordered pair of objects as this, and returns false otherwise.
      • toString

        public java.lang.String toString()
        Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this.