Rodney,

Yes, it's only meaningful when the Map contains one-to-one mappings.

But then, having a BijectionMap doesn't quite address my specific use 
cases. In my case, I got this HashMap from a routine (not written by me). I 
know it's bijection and I need to perform inverse hash lookup. That's why I 
need a key-value swapping routine. If I use a BijectionMap, I have to copy 
the value from the original map into the bijectionMap before doing the 
swapping. It doubles the amount of work. It's an overkill...

Having said that, however, I do see some interesting applications beyond my 
(selfish :-) use cases. For instance, it seems to me this BijectionMap can 
be (semantically) the supertype of the existing DoubleOrderedMap.


At 08:17 pm 19-09-2002, you wrote:
>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?

-- 
John Yu                       Scioworks Technologies
e: [EMAIL PROTECTED]         w: +(65) 873 5989
w: http://www.scioworks.com   m: +(65) 9782 9610 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to