From 380bdd280933e0455d7aa3ef612c453c03b9b5a7 Mon Sep 17 00:00:00 2001 From: Martin Davis Date: Sat, 28 Sep 2024 10:30:11 -0700 Subject: [PATCH] Improve EnvelopeAreaComparator code --- .../jts/algorithm/hull/OuterShellsExtracter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/OuterShellsExtracter.java b/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/OuterShellsExtracter.java index 65df1be24e..daf8000fc1 100644 --- a/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/OuterShellsExtracter.java +++ b/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/OuterShellsExtracter.java @@ -100,11 +100,9 @@ private static class EnvelopeAreaComparator implements Comparator { @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); } }