You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Waldhoff, Rodney" <rw...@us.britannica.com> on 2002/09/19 14:17:49 UTC

RE: [collections] MapUtils.swapsKeysValues()

It seems to me this is only meaningful when (or at least, this is only a
correct implementation when) the Map is a bijection--with a one-to-one
mapping between keys and values.  Otherwise some keys in the source map will
not appear as values in the destination map, and which keys disappear will
be dependent upon the order they are returned by the iterator.

I don't know what your use case is, but I think I'd rather see an explict
bijection class (extends Map) that supports this functionality than a
MapUtils method that is only meaningful for a subset of Maps.

What do you think?