commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anshul Zunke <anshulzu...@gmail.com>
Subject Re: Lang: ObjectUtils
Date Fri, 05 Jul 2013 07:10:02 GMT
I second Ted. Do we really need this function at all? Just for the sake of
adding a piece of code should not run the purpose of adding an API
function.


On Fri, Jul 5, 2013 at 1:24 AM, Benedikt Ritter <britter@apache.org> wrote:

> You could do this with with CollectionsUtils from [Collections].
> But I think we all agree that implementing a Predicate inline is a lot more
> verbose than the proposed method.
>
>
> 2013/7/4 Ted Dunning <ted.dunning@gmail.com>
>
> > A bigger question is why this is needed at all.
> >
> > Why not just use composition?  In guava, one would do this:
> >
> >         Iterables.all(Arrays.asList(foo), new Predicate<Double>() {
> >             @Override
> >             public boolean apply(Double input) {
> >                 return input != null;
> >             }
> >         });
> >
> > Surely the same is already possible with commons.
> >
> >
> >
> > On Thu, Jul 4, 2013 at 12:23 PM, Dave Brosius <dbrosius@mebigfatguy.com
> > >wrote:
> >
> > > This implies that having arrays with some null elements is
> > >
> > > a) somewhat common
> > > 2) a good idea
> > >
> > >
> > > I'd say both are not true.
> > >
> > > I'm not sure the library should promote that the above is the case.
> > >
> > >
> > >
> > > On 07/04/2013 02:43 PM, Rafael Santini wrote:
> > >
> > >> Hi,
> > >>
> > >> I would like to propose a method in ObjectUtils class that receives an
> > >> array of objects and returns true if all objects are not null. I have
> > >> implemented the following:
> > >>
> > >> public static boolean isNull(Object object) {
> > >>    return object == null;
> > >> }
> > >>
> > >> public static boolean isNotNull(Object object) {
> > >>    return isNull(object) == false;
> > >> }
> > >>
> > >> public static boolean isNotNull(Object... objects) {
> > >>    for (Object object : objects) {
> > >>        if (isNull(object)) {
> > >>            return false;
> > >>        }
> > >>    }
> > >>    return true;
> > >> }
> > >>
> > >> Can I submit a patch for this feature?
> > >>
> > >> Thanks,
> > >>
> > >> Rafael Santini
> > >>
> > >>
> > >>
> > >>
> > >>
> > ------------------------------**------------------------------**---------
> > >> To unsubscribe, e-mail: dev-unsubscribe@commons.**apache.org<
> > dev-unsubscribe@commons.apache.org>
> > >> For additional commands, e-mail: dev-help@commons.apache.org
> > >>
> > >>
> > >>
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.**apache.org<
> > dev-unsubscribe@commons.apache.org>
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> > >
> >
>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>



-- 
Anshul Zunke

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message