Indexing access for Lists and Maps considered harmful?
Neal Gafter
neal at gafter.com
Wed Jun 24 19:23:32 PDT 2009
On Wed, Jun 24, 2009 at 6:41 PM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:
> Your general solution does not follow the suggested semantic of returning
> effectively the same value that ends up in the map/list. For example, a map
> that turns any null reference into a marker object would pass-through 'null'
> and not 'MARKER'. It is therefore not a consistent solution.
>
Such a map violates the specification for java.util.Map. Other APIs may be
indexable with a different specification, and a different implementation.
This way of handling indexing can support both forms. Whichever semantics
are decided to be appropriate for any given interface can be implemented
without a change to the language specification.
More information about the coin-dev
mailing list