Indexing access for Lists and Maps considered harmful?
Rémi Forax
forax at univ-mlv.fr
Wed Jun 24 03:04:27 PDT 2009
Bruce Chapman a écrit :
> Ted Neward wrote:
>
>> Under what situation would a = b = c (where b is boxed(c) ) yield different
>> results? Aside from concurrency scenarios, my understanding is that boxed or
>> not, the value is still "c", thus a would hold the value "c", boxed or
>> otherwise.
>>
>>
> Digressing from a multiple assignment (its just one example of using the
> value of an assigment expression), but still using an assignment
> expression as an expression then given
>
> list<Integer> list;
>
> void doSomething(int v) { .... }
>
> void doSomething(Integer v) { ...}
>
> which method is invoked by the following?
>
> doSomething(list[0]=5)
>
> If the implementation is consistent with the existing JLS, then it MUST
> be the second method.
>
> Bruce
>
Yes.
I think you can rewrite your example as a puzzler :
List<Integer> list = ...
void doSomething(int v) { .... } //1
void doSomething(Object o) { ...} //2
doSomething(list[0]=5) // call #2
cheers,
Rémi
More information about the coin-dev
mailing list