Reflect collection changes on another
|
|
|
Composite Collection
Sometimes you need to reflect the changes you made on a collection in another collection providing a single unified view on a so called composite collection.
To achieve this result you can develop you own observer and replicate the changes on you target collection or you can use
Apache Commons Collections
.
Depending on you collection type you can use the following classes :
- CompositeCollection for Collection
- CompositeSet for Sets
Sample usage
Let's illustrate it using two sets called A and B and an unified collection called unifiedCollection containing the items added in A and B
Apache Commons Collection is an essential effective and reliable library�for complex collection manipulation.
Tags: unified , let's , illustrate , collection , asserttrue , called , reflect , setsSébastien Dante Ursini
Java/Finance Specialist
17 Years of experience in Java
22 Year in Banking/Finance
Based in Geneva/Switzerland
Comments
RSS feed for comments to this post