This is an automated email from the ASF dual-hosted git repository. mattjuntunen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit 00703c480cf69599069a1c5a243774cb2afa951f Author: Matt Juntunen <mattjuntu...@apache.org> AuthorDate: Fri Jul 23 21:17:11 2021 -0400 minor sonarqube fixes --- .../commons/geometry/io/euclidean/threed/obj/ObjWriter.java | 8 +------- .../io/euclidean/threed/stl/StlBoundaryWriteHandler3DTest.java | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/commons-geometry-io-euclidean/src/main/java/org/apache/commons/geometry/io/euclidean/threed/obj/ObjWriter.java b/commons-geometry-io-euclidean/src/main/java/org/apache/commons/geometry/io/euclidean/threed/obj/ObjWriter.java index 2f8b6e4..ff9292b 100644 --- a/commons-geometry-io-euclidean/src/main/java/org/apache/commons/geometry/io/euclidean/threed/obj/ObjWriter.java +++ b/commons-geometry-io-euclidean/src/main/java/org/apache/commons/geometry/io/euclidean/threed/obj/ObjWriter.java @@ -466,13 +466,7 @@ public final class ObjWriter extends AbstractTextFormatWriter { private int addToMap(final Vector3D vec, final Map<String, Integer> map) { final String str = createVectorString(vec); - Integer idx = map.get(str); - if (idx == null) { - idx = map.size(); - map.put(str, idx); - } - - return idx; + return map.computeIfAbsent(str, k -> map.size()); } /** Add a face to the buffer. If {@code batchSize} is greater than {@code -1} and the number diff --git a/commons-geometry-io-euclidean/src/test/java/org/apache/commons/geometry/io/euclidean/threed/stl/StlBoundaryWriteHandler3DTest.java b/commons-geometry-io-euclidean/src/test/java/org/apache/commons/geometry/io/euclidean/threed/stl/StlBoundaryWriteHandler3DTest.java index 7c722b2..58a3c99 100644 --- a/commons-geometry-io-euclidean/src/test/java/org/apache/commons/geometry/io/euclidean/threed/stl/StlBoundaryWriteHandler3DTest.java +++ b/commons-geometry-io-euclidean/src/test/java/org/apache/commons/geometry/io/euclidean/threed/stl/StlBoundaryWriteHandler3DTest.java @@ -74,7 +74,7 @@ class StlBoundaryWriteHandler3DTest { } @Test - public void setInitialBufferSize_invalidArg() { + void setInitialBufferSize_invalidArg() { // act/assert GeometryTestUtils.assertThrowsWithMessage( () -> handler.setInitialBufferSize(0),