commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject [collections] redirected code submission Re: [lang] MapUtils.swapsKeysValues()
Date Thu, 19 Sep 2002 04:59:32 GMT
Looks good. This would be [collections] though.

On Thu, 19 Sep 2002, John Yu wrote:

>
> I'd like to propose a very sample addition to MapUtils, a method to swap
> keys and values.
> I have a few use cases requiring this. I wanted to scratch my itch. :-)
>
>
>    static public void swapKeysValues(Map source, Map dest) {
>      Iterator iter = source.entrySet().iterator();
>
>      while(iter.hasNext()) {
>        Map.Entry entry = (Map.Entry) iter.next();
>        dest.put(entry.getValue(), entry.getKey());
>      }
>    }
>
> --
> John Yu                       Scioworks Technologies
> e: john@scioworks.com         w: +(65) 873 5989
> w: http://www.scioworks.com m: +(65) 9782 9610
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message