This discussion is archived
1 Reply Latest reply: Jul 30, 2011 10:26 AM by 801560 RSS

Convert ArrayList to Vector - performance

801560 Newbie
Currently Being Moderated
I have a method which needs to return a Vector object. Now, I realize that I dont really need it to be a Vector here and an ArrayList would do the job too since i dont need a synchronized collection. However, due to framework limitations, the return type must be a vector.

I was wondering if I could improve performance if I add objects to an ArrayList, and convert it into a Vector by doing something like

List list = new ArrayList();

return new Vector(list);

Or would simply adding objects to a Vector be better than doing the above/


  • Correct Answers - 10 points
  • Helpful Answers - 5 points