You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2010/03/06 23:28:04 UTC

Re: svn commit: r919859 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

On 06/03/2010, ggregory@apache.org <gg...@apache.org> wrote:
> Author: ggregory
>  Date: Sat Mar  6 22:09:37 2010
>  New Revision: 919859
>
>  URL: http://svn.apache.org/viewvc?rev=919859&view=rev
>  Log:
>  Change length(String) to length(CharSequence)
>
>  Modified:
>     commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>
>  Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>  URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=919859&r1=919858&r2=919859&view=diff
>  ==============================================================================
>  --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
>  +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Sat Mar  6 22:09:37 2010
>  @@ -4614,7 +4614,7 @@
>       * @return String length or <code>0</code> if the String is <code>null</code>.

s/String/CharSequence/g ?

>       * @since 2.4
>       */
>  -    public static int length(String str) {
>  +    public static int length(CharSequence str) {
>          return str == null ? 0 : str.length();
>      }

Perhaps the Javadoc needs changing too?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r919859 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

Posted by Jörg Schaible <jo...@gmx.de>.
sebb wrote:

> On 06/03/2010, Henri Yandell <fl...@gmail.com> wrote:
>> I find this a tricky one.
>>
>>  When it's explicitly referring to the type, CharSequence seems fine,
>>  but to change the text that is talking about what a method does to:
>>
>>  "Work out a CharSequence's length"
>>
>>  It feels very unwieldy.
>>
>>  Do others find this weird, or is it just me?
> 
> That does look odd, but so does using String when the parameter is a
> CharSequence.
> 
> Using "string" rather than "String" would be a bit better.
> 
> How about "Works out the length of a string of characters" ?
> 
> Still not ideal though.


"Works out the length of a character sequence like String, StringBuilder, 
..." ?

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r919859 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

Posted by sebb <se...@gmail.com>.
On 06/03/2010, Henri Yandell <fl...@gmail.com> wrote:
> I find this a tricky one.
>
>  When it's explicitly referring to the type, CharSequence seems fine,
>  but to change the text that is talking about what a method does to:
>
>  "Work out a CharSequence's length"
>
>  It feels very unwieldy.
>
>  Do others find this weird, or is it just me?

That does look odd, but so does using String when the parameter is a
CharSequence.

Using "string" rather than "String" would be a bit better.

How about "Works out the length of a string of characters" ?

Still not ideal though.

>
>  On Sat, Mar 6, 2010 at 2:28 PM, sebb <se...@gmail.com> wrote:
>  > On 06/03/2010, ggregory@apache.org <gg...@apache.org> wrote:
>  >> Author: ggregory
>  >>  Date: Sat Mar  6 22:09:37 2010
>  >>  New Revision: 919859
>  >>
>  >>  URL: http://svn.apache.org/viewvc?rev=919859&view=rev
>  >>  Log:
>  >>  Change length(String) to length(CharSequence)
>  >>
>  >>  Modified:
>  >>     commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>  >>
>  >>  Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>  >>  URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=919859&r1=919858&r2=919859&view=diff
>  >>  ==============================================================================
>  >>  --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
>  >>  +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Sat Mar  6 22:09:37 2010
>  >>  @@ -4614,7 +4614,7 @@
>  >>       * @return String length or <code>0</code> if the String is <code>null</code>.
>  >
>  > s/String/CharSequence/g ?
>  >
>  >>       * @since 2.4
>  >>       */
>  >>  -    public static int length(String str) {
>  >>  +    public static int length(CharSequence str) {
>  >>          return str == null ? 0 : str.length();
>  >>      }
>  >
>  > Perhaps the Javadoc needs changing too?
>  >
>
> > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r919859 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

Posted by Henri Yandell <fl...@gmail.com>.
I find this a tricky one.

When it's explicitly referring to the type, CharSequence seems fine,
but to change the text that is talking about what a method does to:

"Work out a CharSequence's length"

It feels very unwieldy.

Do others find this weird, or is it just me?

On Sat, Mar 6, 2010 at 2:28 PM, sebb <se...@gmail.com> wrote:
> On 06/03/2010, ggregory@apache.org <gg...@apache.org> wrote:
>> Author: ggregory
>>  Date: Sat Mar  6 22:09:37 2010
>>  New Revision: 919859
>>
>>  URL: http://svn.apache.org/viewvc?rev=919859&view=rev
>>  Log:
>>  Change length(String) to length(CharSequence)
>>
>>  Modified:
>>     commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>>
>>  Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
>>  URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=919859&r1=919858&r2=919859&view=diff
>>  ==============================================================================
>>  --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
>>  +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Sat Mar  6 22:09:37 2010
>>  @@ -4614,7 +4614,7 @@
>>       * @return String length or <code>0</code> if the String is <code>null</code>.
>
> s/String/CharSequence/g ?
>
>>       * @since 2.4
>>       */
>>  -    public static int length(String str) {
>>  +    public static int length(CharSequence str) {
>>          return str == null ? 0 : str.length();
>>      }
>
> Perhaps the Javadoc needs changing too?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org