You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Ruppin <mr...@yahoo.com> on 2003/06/02 22:03:16 UTC
Collection Implementation
Without checking the archives for specific references,
I'm still sure I've read on multiple occasions, "Don't
use Vectors, use ArrayLists". I was under the
impression that this was because Vectors are not
synchronized. After refactoring, today, I read here
that ArrayLists are not synchronized:
http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html
Time to refactor again? I need to be using one of the
static Collections.synchronized* methods, right?
Beyond using Objects that are synchronized, what
difference does it make which implementation of
Collection I choose?
m
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Collection Implementation
Posted by James Norman <ja...@perceptive.com>.
Vectors *are* synchronized. You will still have a problem if your code
looks like
if( vector.contains( someObject) )
vector.remove( anotherObject )
Any will need to synchronize on something else or on the instance
itself.
On Mon, 2003-06-02 at 15:05, sjones wrote:
> some implemenations of collections are faster than others.
>
> Vectors are thought to be the slowest.
>
> you can run a simple test to see guage the impact of using
> one -vs- the other in your application.
>
>
> "Michael Ruppin" <mr...@yahoo.com> wrote in message
> news:20030602200316.70699.qmail@web20002.mail.yahoo.com...
> > Without checking the archives for specific references,
> > I'm still sure I've read on multiple occasions, "Don't
> > use Vectors, use ArrayLists". I was under the
> > impression that this was because Vectors are not
> > synchronized. After refactoring, today, I read here
> > that ArrayLists are not synchronized:
> >
> > http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html
> >
> > Time to refactor again? I need to be using one of the
> > static Collections.synchronized* methods, right?
> > Beyond using Objects that are synchronized, what
> > difference does it make which implementation of
> > Collection I choose?
> >
> > m
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> > http://calendar.yahoo.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Collection Implementation
Posted by sjones <sj...@yahoo.com>.
some implemenations of collections are faster than others.
Vectors are thought to be the slowest.
you can run a simple test to see guage the impact of using
one -vs- the other in your application.
"Michael Ruppin" <mr...@yahoo.com> wrote in message
news:20030602200316.70699.qmail@web20002.mail.yahoo.com...
> Without checking the archives for specific references,
> I'm still sure I've read on multiple occasions, "Don't
> use Vectors, use ArrayLists". I was under the
> impression that this was because Vectors are not
> synchronized. After refactoring, today, I read here
> that ArrayLists are not synchronized:
>
> http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html
>
> Time to refactor again? I need to be using one of the
> static Collections.synchronized* methods, right?
> Beyond using Objects that are synchronized, what
> difference does it make which implementation of
> Collection I choose?
>
> m
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org