Basic HTML version of Foils prepared Sept 21 1998

Foil 25 Methods for Vectors

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


Elements are created with the addElement( ... ) method:
  • Order missouri = new Order();
  • orders.addElement( missouri );
The object missouri of type Order is automatically converted to an Object and added to Vector instance orders defined on the previous foil.
There are methods for indexing vectors. Like arrays, the indexing is zero-based.
  • x = (Typeofx) v.elementAt(i);
  • v.setElementAt( x, i );
The length of the Vector may also be obtained:
  • int size = v.size;



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998