From what I have seen so far the usual way of scoring in java is by using lambda expressions. I often see Try it online used for it. My actual question comes now:
Can you reuse the name of a named lambda to define a variable, thus allowing you to remove the var
? For example, normally you'd do:
f -> {var s = ""; /* rest of the code */}
Are you allowed to make f
a String
to save a few characters? It'd then look like this:
f -> {f = ""; /* rest of the code */}
f
, you're taking advantage of its type. The inputf
shouldn't be mentioned anywhere in your lambda other than the parameter list because it's supposed to not even exist. \$\endgroup\$