Java Reference
In-Depth Information
Chapter 22. Miscellaneous Utilities
The best way to make a fire with two sticks is to make sure one of
them is a match.
Will Rogers
You will find several standard utility interfaces and classes in the
java.util
package. You have seen the collection classes already in
Chapter 21
.
This chapter covers the remainder of the classes except
covered in this chapter are
•
Formatter
A class for producing formatted text.
•
BitSet
A dynamically sized bit vector.
•
Observer
/
Observable
An interface/class pair that enables an object
to be
Observable
by having one or more
Observer
objects that are
notified when something interesting happens in the
Observable
ob-
ject.
•
Random
A class to generate sequences of pseudorandom numbers.
•
Scanner
A class for scanning text and parsing it into values of prim-
itive types or strings, based on regular expression patterns.
•
StringTokenizer
A class that splits a string into tokens based on de-
limiters (by default, whitespace).
•
Timer
/
TimerTask
A way to schedule tasks to be run in the future.
•
UUID
A class that represents a universally unique identifier (
UUID
).
Finally, we look at two other useful classes, housed in the
java.lang
pack-
age: