public class GeospatialDistanceComparator<T extends GeospatialPoint> extends Object implements Comparator<T>
A comparator that sorts geospatial points in order of increasing distance from a given origin point.
Constructor and Description |
---|
GeospatialDistanceComparator(GeospatialPoint origin)
Constructs a new comparator that sorts geospatial points according to
their distance from the given origin point.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(T p1,
T p2)
Compares two geospatial points for order based on their distance from the
origin point given when this comparator was constructed.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public GeospatialDistanceComparator(GeospatialPoint origin)
origin
- the point from which to measure other pointspublic int compare(T p1, T p2)
compare
in interface Comparator<T extends GeospatialPoint>
p1
- the first point to comparep2
- the second point to comparejeospatial is an open-source library hosted at https://github.com/jchambers/jeospatial.