Package net.sf.eBus.config
Class InetAddressComparator
- java.lang.Object
-
- net.sf.eBus.config.InetAddressComparator
-
- All Implemented Interfaces:
Serializable,Comparator<InetAddress>
public class InetAddressComparator extends Object implements Comparator<InetAddress>, Serializable
Compares twoInetAddressaddresses using the address bytes.- Author:
- Charles Rapp
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InetAddressComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(InetAddress a1, InetAddress a2)Returns an integer <, equal to or > zero ifa1is <, 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
-
-
-
-
Method Detail
-
compare
public int compare(InetAddress a1, InetAddress a2)
Returns an integer <, equal to or > zero ifa1is <, equal to or >a2. The comparison is based on the raw IP address octets. Ifa1has fewer bytes or more bytes thana2, 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:
comparein interfaceComparator<InetAddress>- Parameters:
a1- First compared address.a2- Second compared address.- Returns:
- an integer <, equal to or > zero if
a1is <, equal to or >a2.
-
-