Class InetSocketAddressComparator

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<java.net.InetSocketAddress>

    public class InetSocketAddressComparator
    extends java.lang.Object
    implements java.util.Comparator<java.net.InetSocketAddress>, java.io.Serializable
    Compares two java.net.InetSocketAddress instances based on the address bytes and the TCP port. Uses net.sf.eBus.net.InetAddressComparator to compare the socket addresses.
    Author:
    crapp
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      InetSocketAddressComparator()
      Creates a new instance of InetSocketAddressComparator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.net.InetSocketAddress a1, java.net.InetSocketAddress a2)
      Returns an integer <, equal to or > zero if a1 is <, equal to or > a2.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • InetSocketAddressComparator

        public InetSocketAddressComparator()
        Creates a new instance of InetSocketAddressComparator.
    • Method Detail

      • compare

        public int compare​(java.net.InetSocketAddress a1,
                           java.net.InetSocketAddress a2)
        Returns an integer <, equal to or > zero if a1 is <, equal to or > a2. The InetAddresses are compared first. If equal, the ports are compared.
        Specified by:
        compare in interface java.util.Comparator<java.net.InetSocketAddress>
        Parameters:
        a1 - First compared address.
        a2 - Second compared address.
        Returns:
        an integer <, equal to or > zero if a1 is <, equal to or > a2.
        See Also:
        InetAddressComparator