The collection implementations can be augmented with the following functionality:
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 ...