Software architecture
Immutable feature snapshot
Return a structurally immutable report. Executed Java 21 fixture.
Formal Syntax & Structure
java syntaxjava
List.copyOf(ids)Working Example
Example Snippetjava
public class Main { record Report(java.util.List<String> ids) { Report { ids = java.util.List.copyOf(ids); } } public static void main(String[] args) { var ids = new java.util.ArrayList<>(java.util.List.of("O1")); var report = new Report(ids); ids.add("O2"); System.out.println(report.ids()); }}