2026-03-13 15:07 UTC
Fun fact: #IntelliJIDEA still supports this feature! Use language level 20 (Preview) (which is not officially supported anymore). Write code like:
import java.util.List;
class Test {
record Point(int x, int y) {
}
void print(List list) {
for (Point point : list) {
int x = point.x();
int y = point.y();
System.out.println(x + ":" + y);
}
}
}
Replies (1)
-
@tagir_valeev@mastodon.online 2026-03-13 15:08
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); } }