Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 13139 invoked from network); 11 Dec 2004 10:56:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Dec 2004 10:56:59 -0000 Received: (qmail 37296 invoked by uid 500); 11 Dec 2004 10:56:51 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 37264 invoked by uid 500); 11 Dec 2004 10:56:50 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 37250 invoked by uid 99); 11 Dec 2004 10:56:50 -0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FROM_ENDS_IN_NUMS X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtp1.netclusive.de (HELO smtp.netclusive.de) (217.195.36.14) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 11 Dec 2004 02:56:49 -0800 Received: from localhost (localhost [127.0.0.1]) by smtp.netclusive.de (Postfix) with ESMTP id 5269CDE804B for ; Sat, 11 Dec 2004 11:56:46 +0100 (CET) Received: from smtp.netclusive.de ([127.0.0.1]) by localhost (finch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12778-04 for ; Sat, 11 Dec 2004 11:56:46 +0100 (CET) Received: from [62.180.216.94] (c-180-216-94.cvx-h.dial.de.ignite.net [62.180.216.94]) by smtp.netclusive.de (Postfix) with ESMTP id 2541BDE8048 for ; Sat, 11 Dec 2004 11:56:44 +0100 (CET) Message-ID: <41BAD264.6000803@web.de> Date: Sat, 11 Dec 2004 11:56:37 +0100 From: =?ISO-8859-1?Q?J=F6rg_Herbst?= User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: Iterator problems collections References: <41B9E560.2020801@web.de> <011301c4defd$fb6a8210$d6432cd9@SCOLEBOURNE> In-Reply-To: <011301c4defd$fb6a8210$d6432cd9@SCOLEBOURNE> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) powered by [netclusive] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, as far as I could test the code, I get the results I expected (calling .iterator gets me an iterator containing user objects). The problem seems to be when calling CollectionsUtils.filter(...), I don't know the details of the CollectionUtils implementation but the method seems to call some other behaviour than I expect. My code works fine as long as I direct call my iterator() method everything is fine, but using CollectionUtils something gets wrong. Thx for any ideas Joerg > I can't see anything wrong with what you've sent, but I don't have the > complete code. I suggest you break your task down into parts and check > whether you really are converting the objects, or whether perhaps you > are converting them at the wrong time in your logic. > Stephen > > To: > Sent: Friday, December 10, 2004 6:05 PM > Subject: Iterator problems collections > > >> 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: commons-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: commons-user-help@jakarta.apache.org >> >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org