Skip to content

Commit ffdfd36

Browse files
Improving the result of 'appendStringArray' method for empty array inputs
1 parent b5c671f commit ffdfd36

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/de/redstoneworld/redutilities/misc

1 file changed

+2
-2
lines changed

src/main/java/de/redstoneworld/redutilities/misc/Array.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ public class Array {
1111
* @param prefix (String) prefix for the result String
1212
* @param array (String[]) the String array, which is to be merged
1313
* @param separator (String) the separator
14-
* @return the result String; empty if array is empty
14+
* @return the result String; the prefix only if the array is empty
1515
*/
1616
public static String appendStringArray(String prefix, String[] array, String separator) {
17-
if (array.length == 0) return "";
17+
if (array.length == 0) return prefix;
1818

1919
StringBuilder targetString = new StringBuilder(prefix + array[0]);
2020

0 commit comments

Comments
 (0)