groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ledbrook <>
Subject CharSequence.count(Closure)
Date Fri, 22 May 2015 14:13:24 GMT

One of the things I really like about Groovy is how strings can be treated
as sequences of characters. Unfortunately this seems to break down in some
cases. For example, there is no `count()` method that takes a closure. In
my case I'm trying to count vowels, but you might want to count upper case
letters or anything else like that.

Does it make sense to extend all the Iterable methods and properties to
CharSequence as well? Or should developers turn a string into a list,
perform the processing and then convert it back? Either way, the current
setup seems a bit inconsistent.


View raw message