Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 15719 invoked from network); 12 Jun 2009 21:57:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jun 2009 21:57:17 -0000 Received: (qmail 48098 invoked by uid 500); 12 Jun 2009 21:57:27 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 47990 invoked by uid 500); 12 Jun 2009 21:57:27 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 47980 invoked by uid 99); 12 Jun 2009 21:57:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 21:57:27 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [217.12.10.244] (HELO web26207.mail.ukl.yahoo.com) (217.12.10.244) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 12 Jun 2009 21:57:16 +0000 Received: (qmail 94726 invoked by uid 60001); 12 Jun 2009 21:56:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1244843813; bh=S8rJ6oSHP7kU9hiAyOkoOa+H5Jluf9b+N0pNJZKoWf0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=2KeCMaL+lKcfbqsBI5UloHYirqNlkmowIHJyWfBFuM9w0WEdUNK+c51brwG/igx2AzVFUqrFV6NmcYKvqSPPZdmVYbPl8ec7uxU6tOULms/AQVX8ZnzrmikSjdd+wnE1UxeSAPET5UfGNIlFqAq6f/AmlYgelRVdtJGY3dGo7SY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=KzVrb+tQ0XS7xMzUtBbUkW+d+hpqDQ/aMrl0XPpEumdvA9Yq2mG6euD8NxoeEWll7SoYj5dEpjca/ln/RKZOlx8A18GQ05Wz7C0Nc3WR6gthsRLJ7xgCMFm9UfEeY89Qq+cHNbQQWgumzmZ5PfeAki4Nf+HD7lBECc9ZxBE6r+g=; Message-ID: <150354.94440.qm@web26207.mail.ukl.yahoo.com> X-YMail-OSG: vx9IoU0VM1mzv1d6lDGMMcBdAg02i539hw9G0upqOB2jfEzqn5zekvzlD5Zj0S_IirKM5u2VOeqCMqKliy1CHu0naGzqGYvk0N1Gy8cBOhcoUJ4MN_5lumGEcLOAigRjm0yYUeo.Bg1g7OQBS9ocqHBUyoczWRACbNOqE3H_UIFMggkxSLb8nqp3zciQd9pWLPxW9cgNqvCN9P5NxFhqi.bicGSWKTWpTDgUpTlerPbvAvYNm2G2BO_l1hkzubcCH4h7LR6g90ybR66i.YycnSRslDk1I1X8_GVfNLCFaPinYBFXFqz1IyKJQOUd2ewXGaE1gOq9zVAjFjLMKRpoLtdjYh4vEZ.Wc3OB5g_. Received: from [82.228.226.42] by web26207.mail.ukl.yahoo.com via HTTP; Fri, 12 Jun 2009 21:56:52 GMT X-Mailer: YahooMailRC/1277.43 YahooMailWebService/0.7.289.15 References: <847393.87006.qm@web26206.mail.ukl.yahoo.com> <735150.15070.qm@web26201.mail.ukl.yahoo.com> Date: Fri, 12 Jun 2009 21:56:52 +0000 (GMT) From: Adrian Gonzalez Subject: Re : Re : Convert List to Map To: Commons Users List In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-852666233-1244843812=:94440" X-Virus-Checked: Checked by ClamAV on apache.org --0-852666233-1244843812=:94440 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable That's exactly what I was talking about !=0A=0AHas it done its way to commo= ns collection ? (I don't see it in 3.2.1 or in JIRA)=0A=0ACode extract from= http://mail-archives.apache.org/mod_mbox/commons-dev/200709.mbox/ :=0A=0AMap Collect= ionUtils.toMap(Collection input,=0ATransformer keyTransformer, Tran= sformer=0AvalueTransformer, Map map)=0Aor=0AMap CollectionUt= ils.toMap(Collection input,=0ATransformer keyTransformer, Transform= er=0AvalueTransformer)=0A=0A=0A=0A=0A=0A=0A=0A________________________= ________=0ADe : James Carman =0A=C0 : Commons U= sers List =0AEnvoy=E9 le : Vendredi, 12 Juin 2009,= 17h27mn 03s=0AObjet : Re: Re : Convert List to Map=0A=0AWe had a discussio= n of something like what you're asking for in the past:=0A=0Ahttp://mail-ar= chives.apache.org/mod_mbox/commons-dev/200709.mbox/=0A=0A=0AOn Fri, Jun 12, 2009 at 10:55 = AM, Adrian Gonzalez wrote:=0A> Thanks=0A>=0A> Your s= ample works fine for my use case (that's exactly what I'm doing in my code)= , but I was wondering about such utility thing just after looking at :=0A> = http://commons.apache.org/collections/api-release/org/apache/commons/collec= tions/map/TransformedMap.html#decorate(java.util.Map,%20org.apache.commons.= collections.Transformer,%20org.apache.commons.collections.Transformer)=0A> = which is a map-to-map conversions.=0A>=0A> Since commons-collection provide= s map-to-map conversion, why does'nt it provide list-to-map conversion with= the same logic ?=0A>=0A>=0A>=0A>=0A>=0A> ________________________________= =0A> De : Ted Dunning =0A> =C0 : Commons Users List = =0A> Envoy=E9 le : Jeudi, 11 Juin 2009, 23h12mn 10= s=0A> Objet : Re: Convert List to Map=0A>=0A> How is this easier than this:= =0A>=0A> Map m =3D new HashMap();=0A> for (SpecificObject x : list) {=0A> = m.put(s.getId(), s.getDescription());=0A> }=0A>=0A> ?=0A>=0A> Why make th= is soo much harder than it needs to be?=0A>=0A> On Wed, Jun 10, 2009 at 12:= 19 PM, Adrian Gonzalez wrote:=0A>=0A>> Hello,=0A>>= =0A>> I have the same question as=0A>> http://mail-archives.apache.org/mod_= mbox/commons-user/200509.mbox/%3C878e7290050905002752ed543d@mail.gmail.com%= 3E:=0A>>=0A>> I need to do a lot of list-to-map conversions, and I'm lookin= g for a way to=0A>> use commons collections for this.=0A>> I would like to = do something like this:=0A>>=0A>> Map map =3D ListUtils.toMap(list, new Som= eTransformerInterface() {=0A>> void insertIntoMap(Object object, Map map= ) {=0A>> SpecificObject s =3D (SpecificObject) object;=0A>> map.put(s= .getId(), s.getDescription());=0A>> }=0A>> });=0A>>=0A>> Is there a way = to do that with commons collection ?=0A>>=0A>> Thank you very much=0A>>=0A>= >=0A>>=0A>=0A>=0A>=0A>=0A> --=0A> Ted Dunning, CTO=0A> DeepDyve=0A>=0A> 111= West Evelyn Ave. Ste. 202=0A> Sunnyvale, CA 94086=0A> http://www.deepdyve.= com=0A> 858-414-0013 (m)=0A> 408-773-0220 (fax)=0A>=0A>=0A>=0A>=0A=0A------= ---------------------------------------------------------------=0ATo unsubs= cribe, e-mail: user-unsubscribe@commons.apache.org=0AFor additional command= s, e-mail: user-help@commons.apache.org=0A=0A=0A --0-852666233-1244843812=:94440--