commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [commons-geometry] 07/12: Simplify lambda expressions.
Date Thu, 28 Nov 2019 14:12:15 GMT
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit 775ea17ea034aa686fe75d81b7dd074c9226d781
Author: Gilles Sadowski <gilles@harfang.homelinux.org>
AuthorDate: Thu Nov 28 14:19:22 2019 +0100

    Simplify lambda expressions.
    
    Reported by "sonarcloud.io".
---
 .../commons/geometry/euclidean/oned/RegionBSPTree1D.java       | 10 +++-------
 .../commons/geometry/spherical/oned/RegionBSPTree1S.java       |  5 ++---
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
index 7d02293..346680a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/RegionBSPTree1D.java
@@ -34,9 +34,8 @@ import org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree;
  */
 public final class RegionBSPTree1D extends AbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>
{
     /** Comparator used to sort BoundaryPairs by ascending location.  */
-    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR = (BoundaryPair
a, BoundaryPair b) -> {
-        return Double.compare(a.getMinValue(), b.getMinValue());
-    };
+    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR =
+        (a, b) -> Double.compare(a.getMinValue(), b.getMinValue());
 
     /** Create a new, empty region.
      */
@@ -176,10 +175,7 @@ public final class RegionBSPTree1D extends AbstractRegionBSPTree<Vector1D,
Regio
 
         final List<BoundaryPair> boundaryPairs = new ArrayList<>();
 
-        visitInsideIntervals((min, max) -> {
-            boundaryPairs.add(new BoundaryPair(min, max));
-        });
-
+        visitInsideIntervals((min, max) -> boundaryPairs.add(new BoundaryPair(min, max)));
         boundaryPairs.sort(BOUNDARY_PAIR_COMPARATOR);
 
         final List<Interval> intervals = new ArrayList<>();
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
index cec325e..15c8c54 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java
@@ -36,9 +36,8 @@ import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
  */
 public class RegionBSPTree1S extends AbstractRegionBSPTree<Point1S, RegionBSPTree1S.RegionNode1S>
{
     /** Comparator used to sort BoundaryPairs by ascending azimuth.  */
-    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR = (BoundaryPair
a, BoundaryPair b) -> {
-        return Double.compare(a.getMinValue(), b.getMinValue());
-    };
+    private static final Comparator<BoundaryPair> BOUNDARY_PAIR_COMPARATOR =
+        (a, b) -> Double.compare(a.getMinValue(), b.getMinValue());
 
     /** Create a new, empty instance.
      */


Mime
View raw message