Comparator implementation to sort the nameservers to use when follow redirects.
This implementation follows all the semantics listed in the
Comparator apidocs
with the limitation that InetSocketAddress#equals(Object) will not result in the same return value as
compare(InetSocketAddress, InetSocketAddress). This is completely fine as this should only be used
to sort Lists.
| Modifier and Type | Field and Description |
|---|---|
| private final Class | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(InetSocketAddress
the first object to be compared. addr1, InetSocketAddress the second object to be compared. addr2)Implements java. |
| preferredAddressType | back to summary |
|---|---|
| private final Class<? extends InetAddress> preferredAddressType | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| NameServerComparator | back to summary |
|---|---|
| public NameServerComparator(Class<? extends InetAddress> preferredAddressType) | |
| compare | back to summary |
|---|---|
| public int compare(InetSocketAddress addr1, InetSocketAddress addr2) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |