Browse Source

add a simpler arrayToString method

tags/2.0.1
Jonathan Cobb 5 years ago
parent
commit
2c28296705
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/main/java/org/cobbzilla/util/collection/ArrayUtil.java

+ 9
- 0
src/main/java/org/cobbzilla/util/collection/ArrayUtil.java View File

@@ -79,6 +79,15 @@ public class ArrayUtil {
return new ArrayList<>(result); return new ArrayList<>(result);
} }


/**
* Produce a delimited string from an array. Null values will appear as "null"
* @param array the array to consider
* @return the result of calling .toString on each array element, or "null" for null elements, separated by the given delimiter.
*/
public static String arrayToString(Object[] array) {
return arrayToString(array, ", ", "null");
}

/** /**
* Produce a delimited string from an array. Null values will appear as "null" * Produce a delimited string from an array. Null values will appear as "null"
* @param array the array to consider * @param array the array to consider


Loading…
Cancel
Save