This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Vector or array list

 
jacob deiter
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!