Vector : Java Glossary
©1996-2017 Roedy Green of Canadian Mind Products
An array that automatically grows. Now replaced by ArrayList. You would only use Vector only
for compatibility with Java 1.1.
Vector.add( elt ) automatically
tacks on the end.
To get the thread safety of Vector in ArrayList wrap it like
ArrayList a = new ArrayList( 100 );
Collection threadSafeList = Collections.synchronizedCollection( a );
Old and New method names
Vector will often give
you ArrayIndexOutOfBoundsException. There are many ways to
- Using a negative index.
- Indexing past the current end of the Vector with
setElementAt or set. It
will only automatically grow with addElement or
add and it will grow only one element at a time. It
won’t even let you use setElementAt or
set one element past the end.
- Doing a lastIndexOf starting out past the end.
Vectors In Graphics
In the context of graphic image processing
there are two basic types: raster graphics and vector graphics. Raster graphics store
the colour of a dot called a pixel for every tiny cell of the image. Vector graphics
store the begin and end points of lines used to construct an image at any scale.
Vector graphics also typically handle Bezier curves, which are curves that go through
sample points, with the direction and curvature adjusted at each point to smooth the
Vectors In Mathematics
In mathematics, a vector is a something with both a quanity and a direction, e.g.
velocity or a force. A vector is also a tuple of numbers. Three numbers can be used
to represent a direction in 3D. four numbers can represent a point in space-time.
Oracle’s Javadoc on Vector
class : available: