[ 
https://issues.apache.org/jira/browse/GROOVY-7432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14557611#comment-14557611
 ] 

Paul King commented on GROOVY-7432:
-----------------------------------

I agree with your expectations re char vs String of size 1. In fact, I think 
the current behavior should be deemed as a bug for
dropWhile, collectReplacements, and takeWhile. I'll raise a separate issue for 
those. We can make it check for a char/Character
closure as an easy porting strategy.

DGM methods on Object will already use iterator(), so they will use Strings 
already. This includes:
any, collect, each, eachWithIndex, every, find, findAll, findIndexOf, 
findIndexValues, findLastIndexOf, findResult, grep, inject, split
so, there is nothing to do for those methods unless we want to also support 
passing a closure with a char/Character argument type.

That still leaves a bunch of methods not covered, count, collectMany and no 
doubt more.


> Enhance CharSequence with appropriate Iterable extension methods
> ----------------------------------------------------------------
>
>                 Key: GROOVY-7432
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7432
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Peter Ledbrook
>            Assignee: Guillaume Laforge
>
> Groovy enables developers to treat {{CharSequence}}s as if they were true 
> sequences. For example, you can use a for loop and the array index operator. 
> Some extension methods are missing though. One I was hoping to find was the 
> {{count(Closure)}} method. I think it makes sense to incorporate any 
> {{Iterable}} extension methods into {{CharSequence}} as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to