Robert Burrell Donkin wrote:
> Stephan Nagy wrote:
>
> > Robert Burrell Donkin wrote:
> >
> > > "RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:
> > >
> > > > Hello Everyone:
> > > >
> > > > Does anybody know of a method or technique
> > > > to determine if a ElementContainer or any other
> > > > ECS Element is empty, i.e., it contains no Elements?
> > >
> > > this isn't very pretty code but it works for me
> > >
> > > public boolean isEmpty(org.apache.ecs.ConcreteElement element)
> > > {
> > > return !(element.keys().hasMoreElements();
> > > }
> > >
> > > i believe that it should be possible to add a better isEmpty() method to the
> > > ConcreteElement
> > > and maybe that'd be a bit better.
> > > don't know what other people think.
> > >
> >
> > You could add something like that into the base class or do :
> >
> > if(this.keys() == null) { ... } // element is empty
> >
> > Pretty sure that will work.
>
> maybe i'll have a look at testing this.
>
> - robert
i've had a look at the ConcreteElement source and i recon that keys() never returns
null.
this new method (in ConcreteElement) works for me
public boolean isEmpty()
{
return registryList.isEmpty();
}
(i'm fairly confident that isEmpty() is present in the 1.1 vintage vector but maybe
somebody could set me straight if it isn't)
PS appologies for the double post yesterday...
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]