Class Pair<X extends Comparable<X>,​Y extends Comparable<Y>>

  • All Implemented Interfaces:
    Comparable<Pair<X,​Y>>

    public class Pair<X extends Comparable<X>,​Y extends Comparable<Y>>
    extends Object
    implements Comparable<Pair<X,​Y>>
    Simple Pair class. reimplemented since the commons one is final, and I wanted a different toString function...
    • Constructor Detail

      • Pair

        public Pair​(X left,
                    Y right)
    • Method Detail

      • getLeft

        public X getLeft()
      • getRight

        public Y getRight()
      • equals

        public boolean equals​(Object o)
        Calculate whether this pair object is equal to another object.
        Overrides:
        equals in class Object
        Parameters:
        o - The other object (hopefully a pair).
        Returns:
        True if the two are equal; false otherwise.
      • hashCode

        public int hashCode()
        Basic hashcode function. Assume hashcodes of left and right are randomly distributed and return the XOR of the two.
        Overrides:
        hashCode in class Object
        Returns:
        hashcode of the pair.