Results 1 to 6 of 6
Thread: [SOLVED] Vectors
- 05-25-2009, 04:03 PM #1
Senior Member
- Join Date
- Mar 2009
- Posts
- 105
- Rep Power
- 0
[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, 04:46 PM #2
A Vector is an expandable one dimensional array. However, you can have a Vector of Vectors making it like an expandable two dimensional array.a vector is basically an expandable 2D array
When you are going to need an array of x amount of objects but do not know what x will be.What sort of situations would call for this
It is dependent only on the amount of heap available.is there a limit to how large this vector can be or is it only dependent on the heap size?
Mr.Beans
- 05-26-2009, 04:07 AM #3
I suggest using ArrayList instead. Vector has built-in synchronization, which adds a lot of overhead.
- 05-26-2009, 11:21 AM #4
Senior Member
- Join Date
- Mar 2009
- Posts
- 105
- Rep Power
- 0
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, 11:50 AM #5
Member
- Join Date
- Mar 2009
- Posts
- 25
- Rep Power
- 0
Only for objects. So for primitives use there wrapper classes (Integer, Character etc)
- 05-26-2009, 02:11 PM #6
Senior Member
- Join Date
- Mar 2009
- Posts
- 105
- Rep Power
- 0
Similar Threads
-
Vectors of Vectors or hash-somethings?
By mindwarp in forum New To JavaReplies: 3Last Post: 03-10-2008, 02:57 PM -
Help with Vectors and Strings...
By kaban in forum New To JavaReplies: 2Last Post: 12-09-2007, 09:04 AM -
Vectors vs ArrayList
By Java Tip in forum Java TipReplies: 0Last Post: 11-28-2007, 10:29 AM -
Understanding Vectors
By cbrown08 in forum New To JavaReplies: 7Last Post: 11-05-2007, 06:56 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks