You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2023/09/29 17:02:52 UTC

[commons-numbers] 02/02: Use varargs

This is an automated email from the ASF dual-hosted git repository.

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

commit 7028ccbce77a79b49e0c4a549ece355288816087
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Sep 29 17:54:43 2023 +0100

    Use varargs
---
 .../src/test/java/org/apache/commons/numbers/core/DDTest.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/DDTest.java b/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/DDTest.java
index 3cf81c8f..5e9980e3 100644
--- a/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/DDTest.java
+++ b/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/DDTest.java
@@ -2612,8 +2612,7 @@ class DDTest {
     @Test
     void testEqualsWithDifferentNaNs() {
         // Test some NaN combinations
-        final double[] values = {Double.NaN, 0, 1};
-        final ArrayList<DD> list = createCombinations(values);
+        final ArrayList<DD> list = createCombinations(Double.NaN, 0, 1);
 
         // Is the all-vs-all comparison only the exact same values should be equal, e.g.
         // (nan,0) not equals (nan,nan)
@@ -2707,8 +2706,7 @@ class DDTest {
      */
     @Test
     void testHashCodeWithDifferentZeros() {
-        final double[] values = {-0.0, 0.0};
-        final ArrayList<DD> list = createCombinations(values);
+        final ArrayList<DD> list = createCombinations(-0.0, 0.0);
 
         // Explicit test for issue MATH-1118
         // "equals" and "hashCode" must be compatible
@@ -2730,7 +2728,7 @@ class DDTest {
      * @param values the values
      * @return the list
      */
-    private static ArrayList<DD> createCombinations(final double[] values) {
+    private static ArrayList<DD> createCombinations(double... values) {
         final ArrayList<DD> list = new ArrayList<>(values.length * values.length);
         for (final double x : values) {
             for (final double xx : values) {