On 11/9/06, Adam Winer <[EMAIL PROTECTED]> wrote:

What I was suggesting is that we have a BidiMap interface,
and a BidiHashMap implementation of that interface.  So if
you're going to have a getInvertedMap() function, it should
return a BidiMap.


On the topic of general purpose "bidi" maps, it might be worth comparing
notes with the Jakarta Collections project, which IIRC has a similar class.
It might be possible to use such an existing implementation and/or
collaborate on a feature set that meets everyone's needs within the context
of that project.

-- Adam


Craig


On 11/9/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> I thought you would prefer BidiHashMap because
> the internal implementation is two HashMaps.
>
> When I proposed ReverseMap, you suggested ReverseHashMap,
> so now that I like BidiMap, I proposed BidiHashMap because
> I thought you would prefer that :)
>
> what say you?
>
>
> On 11/8/06, Adam Winer <[EMAIL PROTECTED]> wrote:
> > Shouldn't it be BidiMap?  Not BidiHashMap?
> >
> > -- Adam
> >
> >
> > On 11/8/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> > > http://issues.apache.org/jira/browse/ADFFACES-282
> > > --arjuna
> > >
> > > On 11/8/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> > > > Also, can I call this method getInvertedMap?
> > > >
> > > > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> > > >
> > > > ?
> > > >
> > > > On 11/8/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> > > > > ok, since we can't use the commons-collections, let's make
ValueMap
> > > > > public.
> > > > >
> > > > > I was going to call it ReverseHashMap,
> > > > >
> > > > > but since BidiMap seems to be more popular (especially since
> > > > > commons-collections has a BidiMap)
> > > > > can I call this
> > > > > BidiHashMap
> > > > > ?
> > > > >
> > > > >
> > > > > On 10/27/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote:
> > > > > > On 10/27/06, Adam Winer <[EMAIL PROTECTED]> wrote:
> > > > > > > While I've no problem with using commons-collections
internally,
> > > > > > > I'm very reluctant to consider exposing commons-collections
> > > > > > > classes directly in a public API, since it mandates that
> > > > > > > dependency eternally  - and assumes that Commons Collections
> > > > > > > won't just decide to change their API (which they have in
the
> > > > > > > past).  So, -1 to using any commons collections class as
> > > > > > > the return type of any public API.
> > > > > >
> > > > > > good point. In MyFaces we had fun with them in the past too :)
> > > > > >
> > > > > > > We might consider introducing:
> > > > > > >
> > > > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > > > >   {
> > > > > > >      Object getKey(Object value)
> > > > > > >      BidiMap inverseBidiMap()
> > > > > > >      Object removeValue(Object value)
> > > > > > >   }
> > > > > > >
> > > > > > > (modeled after their BidiMap), then as an internal
> > > > > > > implementation detail use a subclass of
> > > > > > > commons-collections' DualHashBidiMap that
> > > > > > > implements our BidiMap.  This eliminates the
> > > > > > > public API dependency, but adds an implementation
> > > > > > > dependency.
> > > > > > >
> > > > > > > I don't know, though, if it's worth adding the
> > > > > > > dependency on commons-collections for this
> > > > > > > one feature.
> > > > > > >
> > > > > > > -- Adam
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 10/27/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> > > > > > > > underlying storage is HashMap.
> > > > > > > >
> > > > > > > > I just found the following in commons:
> > > > > > > >
http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > > > >
> > > > > > > > I wonder if we should use that directly and remove the
current ValueMap?
> > > > > > > >
> > > > > > > > --arjuna
> > > > > > > >
> > > > > > > >
> > > > > > > > On 10/25/06, Adam Winer <[EMAIL PROTECTED]> wrote:
> > > > > > > > >
> > > > > > > > > I guess both are useful;  but what is the underlying
storage?
> > > > > > > > > If it's a HashMap, then this should be called something
like
> > > > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > > > >
> > > > > > > > > -- Adam
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 10/24/06, Arjuna Wijeyekoon <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > Hi,
> > > > > > > > > > I'd like to make
> > > > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > > > a public utility class.
> > > > > > > > > >
> > > > > > > > > > This class maintains a mapping from key to value, and
also from value to
> > > > > > > > > > key. It is useful to create
> > > > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > > > >
> > > > > > > > > > I'd like to call it
> > > > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > > > >
> > > > > > > > > > And I will cleanup the api so that the Map interface
is fully
> > > > > > > > > implemented
> > > > > > > > > > (along with the remove operations).
> > > > > > > > > >
> > > > > > > > > > What do you think about making this class public?
> > > > > > > > > > ??????
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > If we do make this public, which of the following apis
is better?
> > > > > > > > > > ReverseMap<K,V> map;
> > > > > > > > > > V value;
> > > > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > > > or
> > > > > > > > > > Map<V,K> valuemap = map.getReverseMap();
//  option 2
> > > > > > > > > > K Key = valuemap.get(value);
> > > > > > > > > > ???
> > > > > > > > > >
> > > > > > > > > > or should we have both?
> > > > > > > > > >
> > > > > > > > > > --arjuna
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Matthias Wessendorf
> > > > > > http://tinyurl.com/fmywh
> > > > > >
> > > > > > further stuff:
> > > > > > blog: http://jroller.com/page/mwessendorf
> > > > > > mail: mwessendorf-at-gmail-dot-com
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to