View Single Post
  #4 (permalink)  
Old 09-24-2007, 11:51 PM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Default Re: Which is best Vector or ArrayList?

Hi,

Vector has another benefit too -

it is a thread save class - you can add something to the vector or remove something and must not care about other threads, that have access to the vector at the same time. A Vector is easy to use and, I guess, it is used by DefaultTableModel (model from JTable), because it is thread save - you can access the model by one thread without keeping track of concurrently access by the event handling thread for example.

So if you have the choice, choose Vector - if the difference in execution time is relevant for your application, you should better look out for a better algorithm, because the difference is only marginal and you will not win much time by using ArrayList instead of Vector.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Reply With Quote