RE: [lang] LANG-510

2010-03-14 Thread Gary Gregory
> -Original Message- > From: Stephen Colebourne [mailto:scolebou...@btopenworld.com] > Sent: Sunday, March 14, 2010 06:44 > To: Commons Developers List > Subject: Re: [lang] LANG-510 > > I do fear that this discussion may be over-thinking. Most users will, I >

Re: [lang] LANG-510

2010-03-14 Thread Stephen Colebourne
ation for length() and subSequence(). Thoughts? Gary -Original Message- From: Jörg Schaible [mailto:joerg.schai...@gmx.de] Sent: Sunday, March 07, 2010 05:54 To: dev@commons.apache.org Subject: RE: [lang] LANG-510 Gary Gregory wrote: When I replaced the current implementation of St

RE: [lang] LANG-510

2010-03-08 Thread Gary Gregory
for length() and subSequence(). Thoughts? Gary > -Original Message- > From: Jörg Schaible [mailto:joerg.schai...@gmx.de] > Sent: Sunday, March 07, 2010 05:54 > To: dev@commons.apache.org > Subject: RE: [lang] LANG-510 > > Gary Gregory wrote: > > > Whe

RE: [lang] LANG-510

2010-03-07 Thread Gary Gregory
Well, sure, I was just hoping there was a way to make match input and output types. Gary > -Original Message- > From: Jörg Schaible [mailto:joerg.schai...@gmx.de] > Sent: Sunday, March 07, 2010 05:54 > To: dev@commons.apache.org > Subject: RE: [lang] LANG-510 > &g

RE: [lang] LANG-510

2010-03-07 Thread Jörg Schaible
Gary Gregory wrote: > When I replaced the current implementation of StringUtils.left(String,int) > with: > > @SuppressWarnings("unchecked") > public static T left(T cs, int len) { > if (cs == null) { > return null; > } > if (len < 0) { > re

RE: [lang] LANG-510

2010-03-06 Thread Gary Gregory
Here is another issue that I find confusing at first glance with Generics. I redefined defaultIfEmpty in my sandbox as follows: public static T defaultIfEmpty(T str, T defaultStr) { return StringUtils.isEmpty(str) ? defaultStr : str; } This is simple enough but I was surprised

RE: [lang] LANG-510

2010-03-06 Thread Gary Gregory
Here is another low hanging fruit: public static int length(CharSequence str) { return str == null ? 0 : str.length(); } I committed that one since it is trivial and matches the is*(CharSequence) methods already there. Gary > -Original Message- > From: Henri Yandell [m

RE: [lang] LANG-510

2010-03-06 Thread Gary Gregory
To: Commons Developers List > Subject: Re: [lang] LANG-510 > > On Fri, Mar 5, 2010 at 9:32 AM, Henri Yandell wrote: > > Thinking further on moving StringUtils to CharSequence, I'd like to > > take the String left(String, int) method as an example. It depends on > >

Re: [lang] LANG-510

2010-03-05 Thread Jörg Schaible
Paul Benedict wrote: > On Fri, Mar 5, 2010 at 6:17 AM, Niall Pemberton > wrote: >> Hmmm - I expected/assumed it would return the same type. > > Type T means exactly that: one type. It wouldn't be type-safe if the > types were changed between input and output. ?? There is no generic type anymor

Re: [lang] LANG-510

2010-03-05 Thread Paul Benedict
On Fri, Mar 5, 2010 at 6:17 AM, Niall Pemberton wrote: > Hmmm - I expected/assumed it would return the same type. Type T means exactly that: one type. It wouldn't be type-safe if the types were changed between input and output.

Re: [lang] LANG-510

2010-03-05 Thread Niall Pemberton
On Fri, Mar 5, 2010 at 11:12 AM, Jörg Schaible wrote: > Henri Yandell wrote at Freitag, 5. März 2010 10:32: > >> Thinking further on moving StringUtils to CharSequence, I'd like to >> take the String left(String, int) method as an example. It depends on >> substring(int, int), so is entirely possi

Re: [lang] LANG-510

2010-03-05 Thread Jörg Schaible
Henri Yandell wrote at Freitag, 5. März 2010 10:32: > Thinking further on moving StringUtils to CharSequence, I'd like to > take the String left(String, int) method as an example. It depends on > substring(int, int), so is entirely possibly to move over to > subSequence(int, int). > > Hypothetica

Re: [lang] LANG-510

2010-03-05 Thread Niall Pemberton
On Fri, Mar 5, 2010 at 9:32 AM, Henri Yandell wrote: > Thinking further on moving StringUtils to CharSequence, I'd like to > take the String left(String, int) method as an example. It depends on > substring(int, int), so is entirely possibly to move over to > subSequence(int, int). > > Hypothetica