Just a issues to ponder on..
I've two classes. One class is without package structure and other with package structure. Now if update the second class class to have reference to class without package structure, I'm not able to compile the class with package structure.
Is this a Compiler limitatoion.. ? Its looks so but I need to confirm..
Found a reference: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=5a33c13c69c24bf0e9888042287?bug_id=4650921
What do you think about this..
Thursday, January 8, 2009
Thursday, January 1, 2009
Practical Java : Wrapper implementation on Collections
Wrapper implementation on Collections is good feature to know in Collections framework..
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 list = Collections.synchronizedList(new ArrayList());
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?
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?
Subscribe to:
Comments (Atom)