Class ComplexComparator

    • Constructor Detail

      • ComplexComparator

        public ComplexComparator()
    • 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>
        Parameters:
        o1 - first complex number
        o2 - second complex number
        Returns:
        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