diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 767184749..a3ce413c3 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -3177,48 +3177,6 @@ private static String[] splitByCharacterType(String str, boolean camelCase) { // Joining //----------------------------------------------------------------------- - /** - *

Joins the provided elements into a single String.

- * - *

No separator is added to the joined String. - * Null objects or empty string elements are represented by - * empty strings.

- * - *
-     * StringUtils.concat("a", "b", "c") = "abc"
-     * StringUtils.concat(null, "", "a") = "a"
-     * 
- * - * @param elements the values to join together - * @return the concatenated String - * @since 3.0 - */ - public static String concat(Object... elements) { - return join(elements, null); - } - - /** - *

Joins the provided elements into a single String, with the specified - * separator between each element.

- * - *

No separator is added before or after the joined String. - * Null objects or empty string elements are represented by - * empty strings.

- * - *
-     * StringUtils.concatWith(".", "a", "b", "c") = "a.b.c"
-     * StringUtils.concatWith("", null, "", "a") = "a"
-     * 
- * - * @param separator the value to put between elements - * @param elements the values to join together - * @return the concatenated String - * @since 3.0 - */ - public static String concatWith(String separator, Object... elements) { - return join(elements, separator); - } - /** *

Joins the elements of the provided array into a single String * containing the provided list of elements.

@@ -3238,9 +3196,10 @@ public static String concatWith(String separator, Object... elements) { * @param array the array of values to join together, may be null * @return the joined String, {@code null} if null array input * @since 2.0 + * @since 3.0 Changed signature to use varargs */ - public static String join(Object[] array) { - return join(array, null); + public static String join(Object... elements) { + return join(elements, null); } /** diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 24ce46c1c..be814c0e0 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -188,18 +188,10 @@ public void testSwapCase_String() { } //----------------------------------------------------------------------- - public void testConcat_Objects() { - assertEquals("abc", StringUtils.concat("a", "b", "c")); - assertEquals("a", StringUtils.concat(null, "", "a")); - assertEquals(null, StringUtils.concat((Object[])null)); - } - - public void testConcatWith_StringObjects() { - assertEquals("a.b.c", StringUtils.concatWith(".", "a", "b", "c")); - assertEquals("a...b...c", StringUtils.concatWith("...", "a", "b", "c")); - assertEquals("a", StringUtils.concatWith("", null, "", "a")); - assertEquals("a", StringUtils.concatWith(null, null, "", "a")); - assertEquals(null, StringUtils.concatWith(null, (Object[])null)); + public void testJoin_Objects() { + assertEquals("abc", StringUtils.join("a", "b", "c")); + assertEquals("a", StringUtils.join(null, "", "a")); + assertEquals(null, StringUtils.join((Object[])null)); } public void testJoin_Objectarray() {