Indexing access for Lists and Maps considered harmful?
Shams Mahmood
shams.mahmood at gmail.com
Tue Jun 23 16:35:21 PDT 2009
I don't follow why it won't handle anything other than the collections api.The compiler should be able to support any implementations of IndexedAccess<V> and DictionaryAccess<K, V> just like the for each loop handles any implementations of the Iterable interface.
________________________________
From: Neal Gafter <neal at gafter.com>
To: Shams Mahmood <shams.mahmood at gmail.com>
Cc: coin-dev at openjdk.java.net
Sent: Tuesday, June 23, 2009 4:42:40 PM
Subject: Re: Indexing access for Lists and Maps considered harmful?
On Tue, Jun 23, 2009 at 1:55 PM, Shams Mahmood <shams.mahmood at gmail.com> wrote:
>
>So,
>>List<String> list = new ArrayList();
>>list[1] = list[0] = "value";
>>would get translated to:
>>Collections.set(list, 1, Collections.set(list, 0, "value"))
The link to methods in Collections is a bit too magical (e.g. it won't gracefully handle anything other than the collections API nor will it gracefully support evolution of the platform).
More information about the coin-dev
mailing list