HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 4 February 97

Foil 40 Methods for Vectors

From Feb 3 Delivered Lecture for Course CPS616 -- Java Lecture 4 -- AWT Through I/O CPS616 spring 1997 -- Feb 3 1997. by Nancy McCracken * See also color IMAGE
Secs 12.9
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 in vector instance orders defined on 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 can 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 Sun Feb 16 1997