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