Skip to content

Commit

Permalink
Improve EnvelopeAreaComparator code
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Sep 28, 2024
1 parent 7ce18de commit 380bdd2
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ private static class EnvelopeAreaComparator implements Comparator<Geometry> {

@Override
public int compare(Geometry o1, Geometry o2) {
return Double.compare(envArea(o1), envArea(o2));
}

private static double envArea(Geometry g) {
return g.getEnvelopeInternal().getArea();
double a1 = o1.getEnvelopeInternal().getArea();
double a2 = o2.getEnvelopeInternal().getArea();
return Double.compare(a1, a2);
}

}
Expand Down

0 comments on commit 380bdd2

Please sign in to comment.