11.8. Working with Collections
The collection implementations can be augmented with the following functionality:
thread-safety
collection immutability
The collection implementation classes, except for Vector and Hashtable, are not thread-safe, that is, their integrity can be jeopardized by concurrent access. A situation might also demand that a collection be immutable. Java provides solutions to both these requirements through decorators. A decorator object wraps around a collection, modifying the behavior of the collection.
Instead of providing public decorator classes, Java provides static factory methods that return appropriately decorated collection instances. In this regard, these decorators are known as anonymous implementations. In addition ...
Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.