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:25:29 GMT
Repository: groovy
Updated Branches:
  refs/heads/master c68cfc165 -> d5fc12260


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/d5fc1226
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d5fc1226
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d5fc1226

Branch: refs/heads/master
Commit: d5fc12260a0696b36ef0e9551dc8237661083e1c
Parents: c68cfc1
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:24:58 2017 +1000

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/d5fc1226/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 2fded6f..c6fa15e 100644
--- a/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
@@ -3506,27 +3506,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()));
     }
 
     /**
@@ -3543,8 +3544,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);
     }
 
     /**
@@ -3552,8 +3553,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