November 22nd, 2013, 05:38 AM
Vectors and the Vector Class
I'm new to the forum and generally new to programming, but I've been taking this course on programming in Java at my college in Germany and I have a problem to which I have yet been unable to find a viable answer:
For the past week I've been struggling with the concept of vectors and the Cector class. If anybody could give me the cliff notes on what a vector is and where/how it is used I'd be much obliged.
Thanks a lot in advance.
P.S. Let me know if I've made any mistakes in posting my request the way I did.
November 22nd, 2013, 06:10 AM
Do you know what array is?
I mean the storage of elements to which you can have access by indexing the array.
Shortly speaking Vector is just the same.
Though java has plain arrays, they are not always handy. Sometimes we want collections of elements of other types (lists, sets etc.).
That is when interface "Collection" was introduced with several classes implementing this interface. Since plain array could not implement this interface, a kind of wrapper class was designed and named Vector.
Nowadays Vector is not widely used since there are better designed classes with similar properties, for example ArrayList. It is bit strange that class Vector is used in your course. Though it will not do much harm.
- programming problems for novice coders
November 23rd, 2013, 06:26 AM
Yes, that actually helped a lot. Thank you very much.