Class ComplexComparator

    • Constructor Detail

      • ComplexComparator

        public ComplexComparator()
        Empty constructor.

        This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.

    • Method Detail

      • compare

        public int compare​(Complex o1,
                           Complex o2)
        Compare two complex numbers, using real ordering as the primary sort order and imaginary ordering as the secondary sort order.
        Specified by:
        compare in interface Comparator<Complex>
        o1 - first complex number
        o2 - second complex number
        a negative value if o1 real part is less than o2 real part or if real parts are equal and o1 imaginary part is less than o2 imaginary part