Elektrine lite

← Feed

@tagir_valeev@mastodon.online

2026-03-13 15:08 UTC

Now, you'll get an inspection warning with a quick-fix proposing to use the deconstruction pattern! void print(List list) { for (Point(int x, int y) : list) { System.out.println(x + ":" + y); } }

Replies (1)

  • @odrotbohm@chaos.social 2026-03-14 10:39

    @tagir_valeev I sometimes wonder how many of these pattern matching samples incentivize bad design. I have yet to see an example in which it wouldn’t have been better to simply call a method on the object. This here in particular feels like an utterly complex way to write list.forEach(Object::toString); 🤷‍♂️

    Open ##1205357