• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector or array list

 
jacob deiter
Ranch Hand
Posts: 583
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic