This sounds more like a map that validates whether its keys are in a
predetermined Set. That way, the map would operate as normal, size is size
of mappings, cannot add to keySet but can remove etc.

The main idea is to separate the validation Set from the actual keySet. This
is now really easy to achieve as I checked in the
AbstractInputCheckedMapDecorator today, which allows validation to be easily
performed (see checkPutKey). Or use AbstractHashedMap if you don't want to
decorate (see addMapping).

Stephen

----- Original Message -----
From: "Michael Heuer" <[EMAIL PROTECTED]>
> I need an implementation of Map that uses a predefined set of keys as its
> keySet.  Changes made to the set of keys should be reflected in the map's
> keySet but not the other way around, e.g. map.keySet() should be
> unmodifiable.
>
> I've written something using a wrapped map but I'm having trouble
> specifying all of the desired behavior.  For instance, if the size of
> the keySet is > 0 but no mappings exist, what is the size of the map?
> Would the entrySet view contain entries containing each key mapped to
> null?  What should map.remove(key) do?  etc.
>
> Any comments are appreciated.
>
>    michael
>
>
> ---------------------------------------------------------------------
> 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