Skip to content

Commit

Permalink
Update PropertyUtils.java (#73)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
clr-apache and papajdo authored Apr 4, 2023
1 parent f5df438 commit ed7ae03
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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;
Expand All @@ -28,31 +29,29 @@ private 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));
}

/**
Expand Down

0 comments on commit ed7ae03

Please sign in to comment.