Class InetAddressComparator

    • Constructor Detail

      • InetAddressComparator

        public InetAddressComparator()
    • Method Detail

      • compare

        public int compare​(InetAddress a1,
                           InetAddress a2)
        Returns an integer <, equal to or > zero if a1 is <, equal to or > a2. The comparison is based on the raw IP address octets. If a1 has fewer bytes or more bytes than a2, then a negative or positve integer is returned, respectively. Otherwise, the IP address octets are compared until the first non-zero result is found.
        Specified by:
        compare in interface Comparator<InetAddress>
        Parameters:
        a1 - First compared address.
        a2 - Second compared address.
        Returns:
        an integer <, equal to or > zero if a1 is <, equal to or > a2.