Elektrine lite

← Feed

@tagir_valeev@mastodon.online

2026-03-13 15:05 UTC

Enhanced Local Variable Declarations #Java JEP draft is published! https://bugs.openjdk.org/browse/JDK-8357464 Do you remember that the "records in for-each statements" feature was previously a part of JEP 432 and delivered to Java 20 (preview), but dropped since Java 21?

Replies (1)

  • 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); } } }

    Open ##1205355