i recently started learning Java. I was studying Vectors and I came across various methods of declaring a Vector
Vector( )
Vector(int size)
Vector(int size, int incr)
Vector(Collection c)
I was able to understand the first two types but was not able to understand the increment type in 3rd type and what and when to use 4th type.
plz explain.
That means if your vector can store 10 items and you put the 10th in it then teh vector will increase size. You can tell the vector how many items more he can store from that moment on. If you have a vector where you add a lot of items then you can increase increment. then the vector does not have to increase size all the time which takes performance.
You can put a collection of elements in the vector and use the functionality of the vector class.