Hi Iain,
Thanks. I was under the same impression. I'm not adding (or iterating over)
even 10,000 objects, so I'll stick with the Vector.
--jeff
----- Original Message -----
From: "Iain Lowe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 4:45 PM
Subject: RE: ArrayList vs. Vector
> I ran some test code (see attachment) and noticed that if you are adding
> small numbers of objects to the list (Vector or ArrayList) then the Vector
> is faster than the synched ArrayList. As the number of objects to insert
> increases, so does the ArrayLists performance. I ran two tests, one with
> "iterations" set to 10K (create 10000 objects and add them to the list)
and
> one with it set to 100K. In the first test, the Vector was faster but the
> List won out in the long run.
>
> Hope this helps.
>
> -----Original Message-----
> From: Jeff Kilbride [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 23, 2001 5:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: ArrayList vs. Vector
>
>
> I recently re-wrote some older java code (jdk 1.1 based) and one of my
goals
> was to use the new collection classes. I moved all of my
Hashtables/Vectors
> that didn't need to be thread safe to HashMaps/ArrayLists. No problems
under
> Tomcat.
>
> I still use Vectors/Hashtables when I need thread safety, though. Does
> anyone know if it's faster/better to wrap one of the new collection
classes
> in a Collections.synchronized* class instead? It just seems easier to me
to
> use Vectors/Hashtables, since they're already internally synchronized.
>
> Thanks,
> --jeff
>
> ----- Original Message -----
> From: "Hunter Hillegas" <[EMAIL PROTECTED]>
> To: "Tomcat User List" <[EMAIL PROTECTED]>
> Sent: Monday, April 23, 2001 12:36 PM
> Subject: ArrayList vs. Vector
>
>
> > I use Vectors in some parts of my Web app and I'm thinking about using
> > ArrayLists instead...
> >
> > Any caveats to using them in a Web app environment?
> >
> > Hunter
> >
>