Vector csClass = new Vector( 15, 5 ) ;
Rough estimates are good enough. It is better to overestimate the capacity slightly than to underestimate it. A few unused slots do not hurt.
A Vector
object has a capacity
and a size
.
To find out the current capacity of a Vector
use its
capacity()
method.
To find out the current size of a Vector
use its
size()
method.
capacity
is the number of slots available.size
is the number of slots that have data in them.
The elements of a Vector
are accessed using an integer index.
As with arrays,
the index is an integer value that starts at 0.
Vector
the index is 0 to size-1.Vector
the index is 0 to size-1.Vector
the index is 0 to size.size
, you are adding data to the
end of the Vector
.(These rules will be explained in detail in a few pages.)