# [SOLVED] Vectors

• 05-25-2009, 05:03 PM
porchrat
[SOLVED] Vectors
Hi all

It has been a while since my last post, moved onto HTML at university now so that is occupying most of my attention these days.

However there is something I have been wondering about. I have been reading up on vectors, but I don't know if I have properly understood what they are all about.

From what I understand, a vector is basically an expandable 2D array?

What sort of situations would call for this and is there a limit to how large this vector can be or is it only dependent on the heap size?
• 05-25-2009, 05:46 PM
Mr.Beans
Quote:

a vector is basically an expandable 2D array
A Vector is an expandable one dimensional array. However, you can have a Vector of Vectors making it like an expandable two dimensional array.

Quote:

What sort of situations would call for this
When you are going to need an array of x amount of objects but do not know what x will be.

Quote:

is there a limit to how large this vector can be or is it only dependent on the heap size?
It is dependent only on the amount of heap available.

Mr.Beans
• 05-26-2009, 05:07 AM
Steve11235
• 05-26-2009, 12:21 PM
porchrat
thanks guys that has helped me out a lot :)

are vectors generally used for objects only or can vectors be used, like arrays, for primitive types as well?
• 05-26-2009, 12:50 PM
hawaiian robots
Only for objects. So for primitives use there wrapper classes (Integer, Character etc)
• 05-26-2009, 03:11 PM
porchrat
Quote:

Originally Posted by hawaiian robots
Only for objects. So for primitives use there wrapper classes (Integer, Character etc)

OK, that makes sense, thank you :D