Class Pair

  • All Implemented Interfaces:
    Comparable<Pair>

    public class Pair
    extends Object
    implements Comparable<Pair>
    An ordered pair (x,y) is a pair of mathematical objects. In the ordered pair (x,y), the object a is called the first entry, and the object b the second entry of the pair. Alternatively, the objects are called the first and second coordinates, or the left and right projections of the ordered pair. The order in which the objects appear in the pair is significant: the ordered pair (x,y) is different from the ordered pair (y,x) unless x = y.

    This class is immutable.

    • Constructor Detail

      • Pair

        public Pair​(double x,
                    double y)
        Construct a pair.
        Parameters:
        x - x
        y - y
    • Method Detail

      • x

        public double x()
        x
        Returns:
        x
      • y

        public double y()
        y
        Returns:
        y
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object