Is there a way to make Java work with boolean/integer addition and evaluation? More specificly, C++ has an appropriate feature which shortens many if statements.
for (int i = 0; i < n; ++i)
cout << i;
Is equivalent to
while (n--)
cout << n;
Or, instead of:
for (int i = 0; i < n; ++i)
if (x == y)
count++;
One can have
for (int i = 0; i < n; ++i)
count += (x==y);
Is there a way to do something similar to that in Java?