commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1079173 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/StringUtils.java test/java/org/apache/commons/lang3/StringUtilsTest.java
Date Tue, 08 Mar 2011 05:34:02 GMT
Author: bayard
Date: Tue Mar  8 05:34:01 2011
New Revision: 1079173

URL: http://svn.apache.org/viewvc?rev=1079173&view=rev
Log:
Dropping the concat methods. Moving the join(Object[]) to join(Object...). LANG-396. LANG-683.


Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1079173&r1=1079172&r2=1079173&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Tue
Mar  8 05:34:01 2011
@@ -3178,48 +3178,6 @@ public class StringUtils {
     // Joining
     //-----------------------------------------------------------------------
     /**
-     * <p>Joins the provided elements into a single String. </p>
-     *
-     * <p>No separator is added to the joined String.
-     * Null objects or empty string elements are represented by
-     * empty strings.</p>
-     *
-     * <pre>
-     * StringUtils.concat("a", "b", "c") = "abc"
-     * StringUtils.concat(null, "", "a") = "a"
-     * </pre>
-     *
-     * @param elements  the values to join together
-     * @return the concatenated String
-     * @since 3.0
-     */
-    public static String concat(Object... elements) {
-        return join(elements, null);
-    }
-
-    /**
-     * <p>Joins the provided elements into a single String, with the specified
-     * separator between each element. </p>
-     *
-     * <p>No separator is added before or after the joined String.
-     * Null objects or empty string elements are represented by
-     * empty strings.</p>
-     *
-     * <pre>
-     * StringUtils.concatWith(".", "a", "b", "c") = "a.b.c"
-     * StringUtils.concatWith("", null, "", "a") = "a"
-     * </pre>
-     *
-     * @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);
-    }
-
-    /**
      * <p>Joins the elements of the provided array into a single String
      * containing the provided list of elements.</p>
      *
@@ -3238,9 +3196,10 @@ public class StringUtils {
      * @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);
     }
 
     /**

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java?rev=1079173&r1=1079172&r2=1079173&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
Tue Mar  8 05:34:01 2011
@@ -188,18 +188,10 @@ public class StringUtilsTest extends Tes
     }
 
     //-----------------------------------------------------------------------
-    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() {



Mime
View raw message