There are 3 distinct wrappers implementation on collections.
a. Synchronized Wrappers.
b. Unmodifiable Wrappers
c. Checked wrapper
Synchronized wrapper enables to add synchonization to collections. So for example if you have arrayList which is by default not threadsafe can be made Thread-Safe by using the Synchronized wrappers.
Ex: List
Note here that Collections is Class and not Collection interface.
These are normally based on Decorator pattern and since synchronized wrappers add a level of indirection which can have a high performance cost.
Next post will look more into Practical usage of Synchronized wrappers and where it should be used?
No comments:
Post a Comment