O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.8. Summary

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

The important elements you've covered are:

  • The Java collections framework provides you with a range of collection classes implemented as generic types. These enable you to organize your data in various ways.

  • 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required