Main Page

Previous Next


All of the classes in this chapter will be useful sooner or later when you're writing your own Java programs. We'll be applying many of them in examples throughout the remainder of the book.

The important elements we've covered are:

  • You can use a Vector object as a kind of flexible array that expands automatically to accommodate any number of objects stored.

  • The Stack class is derived from the Vector class and implements a pushdown stack.

  • The HashMap class defines a hash map in which objects are stored based on an associated key.

  • An Iterator is an interface for retrieving objects from a collection sequentially. An Iterator object allows you to access all the objects it contains serially – but only once. There's no way to go back to the beginning.

  • The ListIterator interface provides methods for traversing the objects in a collection backwards or forwards.

  • Objects stored in any type of collection can be accessed using Iterator objects.

  • Objects stored in a Vector, a Stack, or a LinkedList can be accessed using ListIterator objects.

Previous Next
JavaScript Editor Java Tutorials Free JavaScript Editor