You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by John Yu <jo...@scioworks.com> on 2002/09/19 05:30:53 UTC
[lang] MapUtils.swapsKeysValues()
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
[collection] Re: [lang] MapUtils.swapsKeysValues()
Posted by John Yu <jo...@scioworks.com>.
Doh! Prefixed the post with the wrong sub-package name...
At 11:30 am 19-09-2002, you 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
[latka] [PATCH] x 2 Update build.xml to use commons-logging.jar
Posted by Janek Bogucki <ya...@studylink.com>.
Can someone apply these patches which add commons-logging.jar to the
classpath used in 'ant test'.
http://issues.apache.org/bugzilla/show_bug.cgi?id=12807
With these patches the test suites start to run but fail (which is a step
forward from not loading.)
Thanks Morgan for applying the last patches I submitted.
Many Thanks,
Janek Bogucki
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
[collections] redirected code submission Re: [lang] MapUtils.swapsKeysValues()
Posted by Henri Yandell <ba...@generationjava.com>.
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: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>