opensubscriber
   Find in this group all groups
 
Unknown more information…

u : user@commons.apache.org 8 September 2009 • 7:23AM -0400

Re: ArrayList nullIfEmpty
by Guy Rouillier

REPLY TO AUTHOR
 
REPLY TO GROUP




Henri Yandell wrote:
> (Presumably the title was meant to be ArrayUtils nullIfEmpty :) )

Yes, thanks for reading my mind.  In the body, I also said ObjectUtils
where I meant ArrayUtils :(.  So many different Utils I got myself
twisted around.

>
> Best way is to open a JIRA issue up
> (http://issues.apache.org/jira/browse/LANG).

I'll open the Jira issue.


> The below should be defaultIfEmpty rather than nullIfEmpty I suspect
> to match StringUtils/ObjectUtils.

I thought about that, but there doesn't appear to be any reasonable
default for arrays other than null.  I don't object to default though,
as for my purposes I can simply pass null for the default.

>
> Hen
>
> On Thu, Aug 27, 2009 at 6:48 PM, Guy Rouillier<guyr-ml1@burn...> wrote:
>> I'm new to this list.  I searched the archives and could not find the
>> subject method discussed.  Has it ever been proposed?  StringUtils has
>> defaultIfEmpty, and ObjectUtils has defaultIfNull, but ObjectUtils doesn't
>> have anything similar.  Since ArrayUtils already has all the necessary
>> isEmtpy methods defined, the following would appear to be sufficient:
>>
>> public static <T> T[] nullIfEmpty(T[] array) {
>>  return(isEmpty(array));
>> }
>>
>> Thanks.
>>
>> --
>> Guy Rouillier
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@comm...
>> For additional commands, e-mail: user-help@comm...
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@comm...
> For additional commands, e-mail: user-help@comm...
>
>


--
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@comm...
For additional commands, e-mail: user-help@comm...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.