2 ms·
No, worse is worse. Pattern matching is much, much cleaner than a switch with the branches extracted in separate functions. I don’t think that anyone using lang
by tigershark 9y ago
No, worse is worse.
Pattern matching is much, much cleaner than a switch with the branches extracted in separate functions.
I don’t think that anyone using languages that support proper pattern matching can disagree.
If someone is writing the same lambda n times instead of extracting it in a common method the problem is not the lambda function, but the developer.
Closures are probably the best feature in Java and they have been delayed enough.
- jjnoakes 9y ago> Pattern matching is much, much cleaner than a switch with the branches extracted in separate functions I don't think that's what is being suggested. I think the suggestion is to move the entire switch statement to a separate function, use 'return' in the switch cases, and have the caller assign the variable once, from the return value of the function.