commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] Updated: (LANG-510) Convert StringUtils API to take CharSequence
Date Sun, 07 Feb 2010 06:54:28 GMT


Henri Yandell updated LANG-510:

    Attachment: LANG-510-indexOf.patch

Very tempting to just add the CharSequence API, and have it call toString() under the hood
if not a String. 

Such a patch is attached.

The value in moving indexOf over to using CharSequence is less in its own value, than in it
will allow us to move many methods over. We get StringBufferUtils for the cost of moving various
methods over to using StringUtils.indexOf with pairs of instanceof checks and casts.

I considered having the code invoke toString() instead of the instanceof/cast for the moment.
They're of general equal cost - the former slightly beats the latter in my performance tests
but the latter is better placed to have us implement our own CharSequence indexOf (which we
need to do at some point).

> Convert StringUtils API to take CharSequence
> --------------------------------------------
>                 Key: LANG-510
>                 URL:
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Henri Yandell
>             Fix For: 3.0
>         Attachments: LANG-510-indexOf.patch
> Wherever possible, use CharSequence and not String in the StringUtils API.
> substring can go to subSequence inside code. The general substring method can be replaced
with a subSequence method and substring deprecated(?). One question is whether to implement
a CharSequence.indexOf type method. Given that it's merely a walking method(?!?), this might
be quite handy and would allow a bunch of StringUtils methods to move over.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message