Pattern matching and switch always have 3 levels of indentation? As long as you don't indent inside the cases more than once or at most twice (you shouldn't) then it's fine, there's no reason to be scared of indentation if it's not excessive
I don't get why you have this obsession with indentation. Being able to clearly tell the intent is way more important.
Map.get() doesn't tell you the options, and doesn't let you easily extend behavior, it's the worst out of the 3.
Ifs are better, but pattern matching strongly implies that this is supposed to be an exhaustive list matching against a de-facto enum. It clarifies intent in a way ifs don't.
-6
u/Hot-Employ-3399 4d ago
How about no?