groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: Improve naming and documentation for String.tokenize (closes #541)
Date Wed, 17 May 2017 01:36:26 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 4c2cff633 -> f1d4d8a8f


Improve naming and documentation for String.tokenize (closes #541)

Calling the delimiter argument token is confusing as according to the
StringTokenizer documentation delimiters are NOT treated as tokens, so call
it delimiter instead. Also make clear that every character in the
CharSequence argument is treated as a separate delimiter.


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/f1d4d8a8
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f1d4d8a8
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f1d4d8a8

Branch: refs/heads/GROOVY_2_4_X
Commit: f1d4d8a8f453882c9812e99d42ed31856965d309
Parents: 4c2cff6
Author: Martin Nonnenmacher <martin.nonnenmacher@gmail.com>
Authored: Tue May 16 14:57:16 2017 +0200
Committer: paulk <paulk@asert.com.au>
Committed: Wed May 17 11:36:11 2017 +1000

----------------------------------------------------------------------
 .../groovy/runtime/StringGroovyMethods.java     | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/f1d4d8a8/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
index 976e391..296d45c 100644
--- a/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
@@ -3343,27 +3343,28 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport
{
      * </pre>
      *
      * @param self  a CharSequence
-     * @param token the delimiter
+     * @param delimiter the delimiter
      * @return a List of tokens
      * @see java.util.StringTokenizer#StringTokenizer(String, String)
      * @since 1.8.2
      */
-    public static List<String> tokenize(CharSequence self, Character token) {
-        return tokenize(self, token.toString());
+    public static List<String> tokenize(CharSequence self, Character delimiter) {
+        return tokenize(self, delimiter.toString());
     }
 
     /**
-     * Tokenize a CharSequence based on the given CharSequence delimiter.
+     * Tokenize a CharSequence based on the given CharSequence. Each character in the CharSequence
is a separate
+     * delimiter.
      *
      * @param self  a CharSequence
-     * @param token the delimiter
+     * @param delimiters the delimiters
      * @return a List of tokens
      * @see java.util.StringTokenizer#StringTokenizer(String, String)
      * @since 1.8.2
      */
     @SuppressWarnings("unchecked")
-    public static List<String> tokenize(CharSequence self, CharSequence token) {
-        return InvokerHelper.asList(new StringTokenizer(self.toString(), token.toString()));
+    public static List<String> tokenize(CharSequence self, CharSequence delimiters)
{
+        return InvokerHelper.asList(new StringTokenizer(self.toString(), delimiters.toString()));
     }
 
     /**
@@ -3380,8 +3381,8 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport
{
      * @see #tokenize(CharSequence, Character)
      */
     @Deprecated
-    public static List<String> tokenize(String self, Character token) {
-        return tokenize((CharSequence) self, token);
+    public static List<String> tokenize(String self, Character delimiter) {
+        return tokenize((CharSequence) self, delimiter);
     }
 
     /**
@@ -3389,8 +3390,8 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport
{
      * @see #tokenize(CharSequence, CharSequence)
      */
     @Deprecated
-    public static List<String> tokenize(String self, String token) {
-        return tokenize((CharSequence) self, (CharSequence) token);
+    public static List<String> tokenize(String self, String delimiters) {
+        return tokenize((CharSequence) self, (CharSequence) delimiters);
     }
 
     /**


Mime
View raw message