commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r754682 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
Date Sun, 15 Mar 2009 16:11:02 GMT
Author: sebb
Date: Sun Mar 15 16:11:01 2009
New Revision: 754682

URL: http://svn.apache.org/viewvc?rev=754682&view=rev
Log:
Genericize; remove invalid Javadoc reference

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java?rev=754682&r1=754681&r2=754682&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java Sun Mar 15
16:11:01 2009
@@ -1989,7 +1989,7 @@
         }
         int closeLen = close.length();
         int openLen = open.length();
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         int pos = 0;
         while (pos < (strLen - closeLen)) {
             int start = str.indexOf(open, pos);
@@ -2007,7 +2007,7 @@
         if (list.isEmpty()) {
             return null;
         } 
-        return (String[]) list.toArray(new String [list.size()]);
+        return list.toArray(new String [list.size()]);
     }
 
     // Nested extraction
@@ -2286,7 +2286,7 @@
 
         int separatorLength = separator.length();
 
-        ArrayList substrings = new ArrayList();
+        ArrayList<String> substrings = new ArrayList<String>();
         int numberOfSubstrings = 0;
         int beg = 0;
         int end = 0;
@@ -2330,7 +2330,7 @@
             }
         }
 
-        return (String[]) substrings.toArray(new String[substrings.size()]);
+        return substrings.toArray(new String[substrings.size()]);
     }
 
     // -----------------------------------------------------------------------
@@ -2420,7 +2420,7 @@
         if (len == 0) {
             return ArrayUtils.EMPTY_STRING_ARRAY;
         }
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         int i = 0, start = 0;
         boolean match = false;
         boolean lastMatch = false;
@@ -2441,7 +2441,7 @@
         if (match || (preserveAllTokens && lastMatch)) {
             list.add(str.substring(start, i));
         }
-        return (String[]) list.toArray(new String[list.size()]);
+        return list.toArray(new String[list.size()]);
     }
 
     /**
@@ -2547,7 +2547,7 @@
         if (len == 0) {
             return ArrayUtils.EMPTY_STRING_ARRAY;
         }
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         int sizePlus1 = 1;
         int i = 0, start = 0;
         boolean match = false;
@@ -2617,7 +2617,7 @@
         if (match || (preserveAllTokens && lastMatch)) {
             list.add(str.substring(start, i));
         }
-        return (String[]) list.toArray(new String[list.size()]);
+        return list.toArray(new String[list.size()]);
     }
 
     /**
@@ -2693,7 +2693,7 @@
             return ArrayUtils.EMPTY_STRING_ARRAY;
         }
         char[] c = str.toCharArray();
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         int tokenStart = 0;
         int currentType = Character.getType(c[tokenStart]);
         for (int pos = tokenStart + 1; pos < c.length; pos++) {
@@ -2714,7 +2714,7 @@
             currentType = type;
         }
         list.add(new String(c, tokenStart, c.length - tokenStart));
-        return (String[]) list.toArray(new String[list.size()]);
+        return list.toArray(new String[list.size()]);
     }
 
     // Joining
@@ -2925,7 +2925,7 @@
      * @return the joined String, <code>null</code> if null iterator input
      * @since 2.0
      */
-    public static String join(Iterator iterator, char separator) {
+    public static String join(Iterator<?> iterator, char separator) {
 
         // handle null, zero and one elements before building a buffer
         if (iterator == null) {
@@ -2969,7 +2969,7 @@
      * @param separator  the separator character to use, null treated as ""
      * @return the joined String, <code>null</code> if null iterator input
      */
-    public static String join(Iterator iterator, String separator) {
+    public static String join(Iterator<?> iterator, String separator) {
 
         // handle null, zero and one elements before building a buffer
         if (iterator == null) {
@@ -3015,7 +3015,7 @@
      * @return the joined String, <code>null</code> if null iterator input
      * @since 2.3
      */
-    public static String join(Collection collection, char separator) {
+    public static String join(Collection<?> collection, char separator) {
         if (collection == null) {
             return null;
         }
@@ -3036,7 +3036,7 @@
      * @return the joined String, <code>null</code> if null iterator input
      * @since 2.3
      */
-    public static String join(Collection collection, String separator) {
+    public static String join(Collection<?> collection, String separator) {
         if (collection == null) {
             return null;
         }
@@ -5579,7 +5579,6 @@
      * StringUtils.startsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true
      * </pre>
      *
-     * @see java.lang.String#startsWithAny(String, String[])
      * @param string  the String to check, may be null
      * @param searchStrings the Strings to find, may be null or empty
      * @return <code>true</code> if the String starts with any of the the prefixes,
case insensitive, or



Mime
View raw message