You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by cl...@apache.org on 2023/04/04 21:06:02 UTC

[db-jdo] branch main updated: Update PropertyUtils.java (#73)

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

clr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/db-jdo.git


The following commit(s) were added to refs/heads/main by this push:
     new ed7ae034 Update PropertyUtils.java (#73)
ed7ae034 is described below

commit ed7ae0340c272e2c2fd27d026336419ca86d2c24
Author: Craig L Russell <ap...@gmail.com>
AuthorDate: Tue Apr 4 14:05:56 2023 -0700

    Update PropertyUtils.java (#73)
    
    * Update PropertyUtils.java
    
    JDO-819 Fix code smells
    Use "Arrays.copyOf", "Arrays.asList", "Collections.addAll" or "System.arraycopy" instead.
    
    * Update PropertyUtils.java
    
    Fix formatting issues by updating javadoc.
    
    * Fix formatting
    
    * Fix formatting (again)
    
    ---------
    
    Co-authored-by: clr-apache <cl...@apache.org>
---
 .../java/org/apache/jdo/exectck/PropertyUtils.java | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java b/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
index 07473bce..ef579fbb 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
@@ -16,6 +16,7 @@ package org.apache.jdo.exectck;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Properties;
@@ -28,31 +29,29 @@ public class PropertyUtils {
   }
 
   /**
-   * Separates white space separated items from a String into Collection entries Used to collect
-   * command line argument lists into a Collection
+   * Separates white space separated items from a String into a Set.
+   *
+   * <p>Used to collect command line arguments.
    *
    * @param names String of white space separated items
-   * @param list HashSet to contain String items
+   * @param set Set to contain String items
    */
-  public static void string2Set(String names, Collection<String> list) {
+  public static void string2Set(String names, Collection<String> set) {
     String[] items = names.split("[ \t\n]");
-    for (String s : items) {
-      list.add(s);
-    }
+    set.addAll(Arrays.asList(items));
   }
 
   /**
-   * Separates white space separated items from a String into HashSet entries Used to collect
-   * command line argument lists into a Collection
+   * Separates white space separated items from a String into a List.
+   *
+   * <p>Used to collect command line arguments.
    *
    * @param names String of white space separated items
-   * @param list HashSet to contain String items
+   * @param list List to contain String items
    */
   public static void string2List(String names, List<String> list) {
     String[] items = names.split("[ \t\n]");
-    for (String s : items) {
-      list.add(s);
-    }
+    list.addAll(Arrays.asList(items));
   }
 
   /**