Like in topic - what would you see in Java?
My propositions:
1. Operator overloading
This would be VERY useful for vector and matrix math, I think this is obvious.
2. New “for” loop
We use code like this very often:
for (int i = 0; i<20; i++) {
for (int i2 = 0; i2<20; i2++) {
doOrGetSomething(i, i2);
}
}
Why not replace it with something like this:
for (int i -> 0 : 20) {
for (int i2 -> 0 : 20) {
doOrGetSomething(i, i2);
}
}
or this:
for (int i, i2 -> 0 : 20) {
doOrGetSomething(i, i2);
}
or even this (only for arrays and collections) - I know we have “for each” loop, but it cannot be used in some cases:
for (int i, i2 -> array2d) {
doOrGetSomething(array2d[i][i2]);
}
for (int i -> list) {
doOrGetSomething(list.get(i));
}
Both of this ideas are just syntatic sugar, but in my opinion would be useful.