--- On Fri, 9/10/10, Adam Heath <[email protected]> wrote:
> I haven't had this be a problem for
> me in production anywhere, but I noticed that when
> remove(Object) is called, it'll remove the value from the
> top-most map in the stack.  This then means any queries
> for the key will fall-thru to lower maps, which is
> definately *not* what should occur.

That would depend on your point of view. From a variable scoping viewpoint, 
that would be the correct behavior.

Let's say I have two variables, both with the same name. One is declared early 
on and could be considered "global." The other is declared inside a method and 
is considered "local." If I remove the local variable, I would expect the 
global variable to still be there.

> Additionally, entrySet() returns an unmodifiable Collection
> of Map.Entry.  However, those entries point to the
> *original* map.  If someone called setValue() on the
> entry, it would modify the original map, instead of
> inserting a value into the top-most map.

Huh? How can you modify an unmodifiable collection? If that's possible, then my 
recommendation would be to enforce the unmodifiable part and not worry about 
which scope is being changed.

-Adrian




Reply via email to