This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
You would usually be better off using java.util.ArrayList than Vector. And you are also better using the name of the interface List to declare the list rather than the class name. And don't use variable names like newvct; call them something which a reader can understand.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
4
posted
0
And to get the elements back use the for-each loop or an Iterator rather than an Enumeration.
Thanks Campbell Ritchie. I figured out the difference between Vector and ArrayList
Anyone interested may visit this link to know more about the difference JAVA FORUM
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
4
posted
0
Originally posted by Balasubramanian Chandrasekaran: Thanks Campbell Ritchie. I figured out the difference between Vector and ArrayList
Anyone interested may visit this link to know more about the difference JAVA FORUM
Only too pleased to help. And well done tracking down the difference, but the posts on that Sun forum are much harder to understand than anything on JavaRanch
After reading the differences between Vector class and ArrayList i can understand that it differs in the way of synchronization. Synchronization is the only bottle neck in using Vector when compared to ArrayList or else more?
Adam Schaible
Ranch Hand
Joined: Oct 04, 2007
Posts: 101
posted
0
It's a legacy List implementation - I would strongly suggest not using it for new code. I'd suggest using ArrayList as your "default" list implementation, and use other structures when it makes sense.