Perhaps you could take a look at the new BidiMap interface and
implementations in the current CVS. These provide a full bidirectional
implementation. Your proposal isn't covered by BidiMap fully though, as that
interface currently restricts to one key for each value.

If having looked at that you feel that your 'need' is not met, then I think
that an addition to MapUtils could be possible.

Stephen

----- Original Message -----
From: "Ryan Schutt" <[EMAIL PROTECTED]>
> I have an idea for a Map that I think would fit nicely in the commons
> collections library.  The idea is to add a method
>
> Set keySetForValue(Object value)
>
> that would return the set of key's that are mapped to the given value.
For
> example:
>
> map.put("1", "2");
> map.put("2", "1");
> map.put("3", "3");
> map.put("4", "1");
>
> map.keySetForValue("1") returns a set containing {"2", "4"}.
>
> I've often found the need for doing this kind of reverse lookup when using
maps
> for 1-to-N relationships.  If this sounds like something that fits within
the
> scope of the commons collections project, let me know and I'll commit an
> initial implementation.
>
> -Ryan
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to