The vector basically can accept dynamic addition and deletion of elements where as an array can't. Practical Examples where we use are... 1.Reservation system>>Airline or Railway >>Where u create a big list of names and u go on adding and deleting the reservations.
Kadiyala S Naga Sai, Petronas Ammonia Sdn Bhd, Kerteh, Malaysia 24300
he's not talking arrays, he's talking ArrayList. Apart from synchronization there's no reason to use Vector at all. ArrayList outperforms Vector everywhere and has a far richer API making it the preferred choice. If you need synchronization using a synchronized ArrayList can well be preferred over a Vector because of those reasons.
ArrayList and Vector are very similar. Both of them represent an array where you access to the elements in it through an index. One of the main differences is that Vector class is synchronized while ArrayList is not. ArrayList class was part of the collection framework since version 1.2 while Vector class was present since the beginning. I think you'll find this article quite helpful. [ March 04, 2004: Message edited by: Vicken Karaoghlanian ]
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss