Jan. 2nd, 2013

juan_gandhi: (Default)
https://groups.google.com/forum/?fromgroups=#!topic/scala-user/nC263xUiaQo

The same dumb stupid Java where you can only pass a final into an internal class...

"
List<Integer> ints = new ArrayList<>(); 
ints.add(1); 
ints.add(2); 
ints.add(3); 

int sum = 0; 
ints.forEach(i -> {sum += i;}); 

The compiler error is: "value used in lambda expression should be effectively final". I got some bad suspicion and tried whether this compiles:
int sumArray[] = new int[] { 0 }; 
ints.forEach(i -> {sumArray[0] += i;}); 

This did compile.
"
juan_gandhi: (Default)
I mean, come over here to dreamwidth!
Seems like not everyone yet has an account; please open one before lj gets laid forever, and let's be friends.

Алё, люди добрые, давайте все дружить на dreamwidth!
juan_gandhi: (Default)
I wonder how crossposting looks like now

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

October 2025

S M T W T F S
    1 23 4
5 678 9 1011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 13th, 2025 11:48 am
Powered by Dreamwidth Studios