Vector or Array List which one is better for WebApplication?
Joined: Nov 19, 2008
Dear all, I am doing a webapplication with Oracle as backend.Earlier in a differnet applicaiton i used vector but it takes sometime to retrieve the db values . i read in internet like below
1.Vector and Arraylist are grownable or shinkable where are array is not. 2.Vector and Arraylist are implemented from List interface where as array is a primitive data type 3.Vector is Synchrnized where as arraylist is not 4.For best performance better to use arraylist than vector
i am confused which one i should use for webapplication.
Joined: Nov 20, 2007
Vector is like the red-headed stepchild in the java household. ArrayList for the win!
Joined: Oct 13, 2005
Welcome to JavaRanch
I hope you understood Taariq San's metaphor!
You need to be very careful about what they say on the internet. ArrayList is a class which you can make objects from, but you mustn't confuse it with an array.
If you read anywhere that an array is a primitive data type in Java, that is mistaken. An array is an object in its own right. They are correct if they mean that arrays can contain primitives and ArrayLists can't (but you can put primitives into ArrayLists and have them auto-boxed into reference types). They are also correct that ArrayList implements the List<E> interface, but so does Vector.