The
String class, § C.2.1, provides
constant character sequences, as opposed to the C++ standard library
component of the same name, which allows a wide variety of imperative
operations. The Buffer class, § C.2.3, is the much
simpler, and so more limited
alternative to imperative
standard strings.
As elsewhere in the
library, the primary reason for avoiding the
standard library components is the need to provide pool-based memory
allocation via parameterized rather than static state. In this case, the
freedom to expose to clients the results of hash code computation,
§ C.2.2, is an additional advantage.