java.lang.Object
net.i2p.router.web.helpers.RouterInfoComparator
- All Implemented Interfaces:
Serializable, Comparator<RouterInfo>
Sorts in true binary order, not Base64 string order. A-Z a-z 0-9 -~.
Field Summary
Modifier and TypeFieldDescriptionstatic final RouterInfoComparatorShared stateless instance; this comparator holds no state.private static final longPinned for serialized-form compatibility.Constructor Summary
ConstructorsConstructorDescriptionThe comparator reads nothing but the two addresses it is handed, so a bare instance behaves exactly like the _instance singleton.Method Summary
Modifier and TypeMethodDescriptionstatic intcomp(RouterInfo l, RouterInfo r) Static comparison of two RouterInfos by their hash.intcompare(RouterInfo l, RouterInfo r) Compare two RouterInfos by their hash.static RouterInfoComparatorThread safe, no state.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, max, min, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Field Details
serialVersionUID
private static final long serialVersionUIDPinned for serialized-form compatibility.- See Also:
_instance
Shared stateless instance; this comparator holds no state.
Constructor Details
RouterInfoComparator
RouterInfoComparator()The comparator reads nothing but the two addresses it is handed, so a bare instance behaves exactly like the _instance singleton.
Method Details
getInstance
Thread safe, no state.- Returns:
- the shared stateless comparator instance
compare
Compare two RouterInfos by their hash.- Specified by:
comparein interfaceComparator<RouterInfo>- Parameters:
l- non-nullr- non-null
comp
Static comparison of two RouterInfos by their hash.- Parameters:
l- non-nullr- non-null- Returns:
- negative, zero or positive as the first RouterInfo's identity hash sorts before, equal to, or after the second