Wouldn't this be nice?
crazybob at crazybob.org
Wed Nov 11 10:38:33 PST 2009
On Wed, Nov 11, 2009 at 10:31 AM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:
> How exactly do you imagine the proposed for (char c : string) syntax works?
Using charAt(), like I would normally do.
> Any other situation and the array copy is an irrelevant drop in the bucket
> compared to all the other stuff that will be going on. In such niche
> situations, I get the feeling that you probably should roll with char or
> even byte arrays from the start, instead of going through java.lang.String.
I'm writing library code (uri parsing, for example), so I'm stuck with
String, and can't tolerate an extra 2 iterations (one to zero out the
allocated array, and one to copy the char from the string, in addition to
iterating over the chars in the final array).
More information about the coin-dev