Hi folks,
I've got a problem with the CollecionUtils.filter method and the Iterator wrappers. I've written a custom Collections class which stores a tree data structure (based on DefaultMutableTreenode).
I want to hide the implementation (the usage of DefaultMutableTreeNode) and provided an iterator() methods which should return my user objects:
/**
* Gets an iterator with all user objects
*/
public Iterator iterator() {
Iterator it = new EnumerationIterator(
root.breadthFirstEnumeration(),this);
Iterator tranformedIt =
IteratorUtils.transformedIterator(it,
new TreeNodeToUserObjectTransformer());
return tranformedIt;
}/**
* Internal Transformer class for converting a TreeNode
* to it's user object
*/
private class TreeNodeToUserObjectTransformer implements Transformer {
public Object transform(Object o) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) o;
return node.getUserObject();
}
}
Now I'm calling CollectionUtils.filter(myCollection,myPredicate) and suspected to get my user objects passed to the removed(Object o) method. But instead of getting the userObjects, I get DefaultMutableTreeNOdes. Can anybody tell me what I'm doing wrong?
Thx Joerg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
