Multiple SAMs for same concept
Pavel Minaev
int19h at gmail.com
Thu Jul 15 20:28:23 PDT 2010
On Thu, Jul 15, 2010 at 5:56 PM, Reinier Zwitserloot
<reinier at zwitserloot.com> wrote:
> True, most lists of 'these SAMs are distinct but really mean the same thing'
> aren't 100% compatible with each other, but this in practice occurs all the
> time. For example, Map itself does not mention whether or not one can use
> null as either key or value.
Actually, Map does mention that either case is valid. In other words,
the fact that null keys _may_ be invalid is part of the contract, so
client knows that he must not try to add entries with such keys, and
also knows that he must be prepared to deal with such entries while
iterating etc.
A more apt comparison would be some form of structural typing for
interfaces - the ability to take any interface, and "magic-cast" it to
another unrelated interface which just happens to have the same
methods. This proposal is, in effect, the same thing, but restricted
to SAMs.
More information about the lambda-dev
mailing list