File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Vector or array list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Vector or array list" Watch "Vector or array list" New topic

Vector or array list

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 580
Vector are synchronized and array list are unsynchronized.Vector are most suitable when we handle with Multi threading.In Struts 1.2,Action are singleton ,work on multi threading.So for Struts 1.2 ,application Array list is suitable or Vector list
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
The term Singleton is vastly overused, a few lines of code in a large program that is only used once is a candidate for just unrolling the loop and placing the code directly in the instruction stream. Doing so avoids several issuse that in compiler design may become nasty in unrecognized ways.

If your data structure is exposed to more than one thread, use synchronized data structures. To do otherwise is speculative.

"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Normally if you have a List of something, it should be stored in the ActionForm, not the Action. ActionForm classes are not multithreaded. Furthermore, if you want to make an ArrayList Synchronized, you can with the following code:

Consultant, Sima Solutions
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks Merrill
I agree. Here's the link:
subject: Vector or array list
It's not a secret anymore!