commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: ArrayList nullIfEmpty
Date Mon, 07 Sep 2009 23:23:07 GMT
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@burntmail.com> 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@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 


-- 
Guy Rouillier

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


Mime
View raw message