21
C H A P T E R
The Package
java.util
T
HE
java.util
The P
package contains v
ackage java.util
arious utility classes and interfaces.
Notable among these utilities is the
Enumeration
interface. An object that
implements this interface will generate a series of items, delivering them on
demand, one by one. Container classes such as
Dictionary
and
Vector
provide
one or more methods that return an
Enumeration
.
A
BitSet
contains an indexed collection of bits that may be used to represent
a set of nonnegative integers.
The class
Date
provides a convenient way to represent and manipulate time
and date information. Dates may be constructed from a year, month, day of
month, hour, minute, and second, and those six components, as well as the day of
the week, may be extracted from a date. Time zones and daylight saving time are
properly accounted for.
The
abstract
class
Dictionary
represents a collection of key value pairs
and allows a value to be fetched given the key. The class
Hashtable
is one con
crete implementation of
Dictionary
. The class
Properties
extends
Hashtable
by allowing one table to provide default values for another and by providing stan
dard means for reading entries from files and writing entries to files.
The class
Observable
provides a mechanism for notifying other objects,
called observers, whenever an
Observable
object is changed. An observer
object may be any object that implements the
Observer
interface. (This notifica
tion mechanism is distinct from that provided by the
wait
and
notify
methods of
class
Object
( 20.1) and is not connected with the thread scheduling mecha
nism.)
The class
Random
provides an extensive set of methods for pseudorandomly
generating numeric values of various primitive types and with various distribu
tions. Each instance of class
Random
is an independent pseudorandom generator.
A
StringTokenizer
provides an easy way to divide strings into tokens. The
set of characters that delimit tokens is programmable. The tokenizing method is
much simpler than the one used by the class
java.io.StreamTokenizer
. For
example, a
StringTokenizer
does not distinguish among identifiers, numbers,
and quoted strings; moreover, it does not recognize and skip comments.
615
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved