What about using Set?
"Diethelm Guallar, Gonzalo" wrote:
>
> > > Quick solution: would it be Ok to replace that code with
> > >
> > > Vector packages = TurbineResources.getVector("module.packages");
> > > String basePackage = GenericLoader.getBasePackage();
> > > if (! vector.contains(basePackage))
> > > packages.addElement( basePackage );
> > >
> > > everywhere? If yes, would this be a candidate for a utility
> > > function, and where (what class)?
> >
> > That is totally the right way to do it.
>
> I just tested this, and it seems to work. What's best, I'm back
> to the original observed performance. Hurrah!
>
> > Send a patch. :-)
>
> Better than that, I'll commit this myself! However, I have
> a (code-commit-newbie) question: this could be a routine like
>
> public static boolean addOnce(Vector v, Object o)
> {
> if (! v.contains( o ))
> v.addElement( o );
> }
>
> Where would this go? Or should I just write those lines
> everywhere it's needed (bad form)?
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]