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

Chapter 14. The Collections Framework

In this chapter you'll look at the Java collections framework, which consists of generic types that represent sets of collection classes. These generic types are defined in the java.util package, and they provide you with a variety of ways for structuring and managing collections of objects in your programs. In particular, the collection types enable you to deal with situations where you don't know in advance how many objects you'll need to store, or where you need a bit more flexibility in the way in which you access an object from a collection than the indexing mechanism provided by an array.

In this chapter you will learn:

  • What sets, sequences, and maps are, and how they work

  • What a Vector<T> collection object is and how to use Vector<T> objects in your programs

  • How to manage Vector<T> objects so that storing and retrieving elements is typesafe

  • What a Stack<T> collection is and how you use it

  • How you use the LinkedList<T> collections

  • How you store and retrieve objects in a hash table represented by a HashMap<K,V> object

  • How you can generate hashcodes for your own class 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