[Chapter 1] 1.5 The java.util Package

#

| Chapter 1 Introduction |

## 1.5 The java.util Package

The `java.util` package contains a number of useful classes and interfaces that support fundamental data structures and notification-related design patterns. Java depends directly on several of the classes in this package, and you may find many of these indispensable.

A number of classes in `java.util` are designed to help you manage a collection of objects. For example, the `Vector` class supports variable-length arrays of objects, while the `Hashtable` class can be used to create hashtables, or associative arrays, that contain key/value pairs of objects. In addition, the `Enumeration` interface defines methods for iterating through a collection of elements. Chapter 5, Collections, provides more detailed information on using these classes effectively in your Java programs.

The `StringTokenizer` class parses strings into distinct tokens separated by delimiter characters. This class is described in more detail in Chapter 2, Strings and Related Classes.

The `java.util` package contains a number of new classes in Java 1.1 to support internationalization. Many of these classes work in conjuction with the classes defined in the new `java.text` package. The most important new class is the `Locale` class, which represents a particular locale, or country and language, for internationalization purposes. The new `Calendar` and `TimeZone` classes interpret the value of a `Date` object in the context of a particular calendar system; the `Date` class existed in Java 1.0.2, but many of its methods are deprecated in Java 1.1. Finally, the `ResourceBundle` class and its subclasses, `ListResourceBundle` and `PropertyResourceBundle`, represent sets of localized data in Java 1.1.

Two other new entities in `java.util` are the `EventObject` class and the `EventListener` interface. These items form the basis of the new event model in Java 1.1.

See Chapter 17, The java.util Package, for complete reference material on all of the classes in the `java.util` package.

The java.net Package |  | The java.text Package