Gibran Castillo wrote:. . . Do you use immutable objects in your book? . . .
I would hope they do.
Immutable objects can safely be interned and shared, without any need for copying or using the
clone() method. So, it might appear expensive to create multiple objects, but they can be more economical on space because duplicates are not necessary. Similarly, there is no need to take defensive copies.
Another advantage of immutable objects is that they are implicitly thread‑safe.