Indexing access for Lists and Maps considered harmful?

Roel Spilker r.spilker at gmail.com
Wed Jun 24 14:26:31 PDT 2009


The following code and compiler output suggest that the value of (a =
expr) not expr is.

class Foo {
	public static void main() {
		int x, expr;
		long a;
		x = (a = expr);
	}
}

Foo.java:5: possible loss of precision
found   : long
required: int
                x = (a = expr);
                       ^
1 error



2009/6/24 Joshua Bloch <jjb at google.com>

> I'm with Artur on this.  I think we're making a mountain out of a molehill.
>  The fact that  collection.put(value) is an implementation detail.  The
> value of (a = expr) is and should remain expr.
>                   Josh
>



More information about the coin-dev mailing list