Prototype: copyTags(List<String>) -> List<String> returns a fresh mutable copy preserving exact order and duplicates. Mutating either copy afterwards must not affect the other; strings are nonnull.

Final: freeze(String name,List<String> tags) -> Snapshot requires nonnull nonempty name (IllegalArgumentException otherwise), preserves tag order/duplicates, and retains a detached unmodifiable list. Snapshot's generated accessors/equality are used directly. Mutation of source after return must not affect snapshot; tag mutation through the accessor must throw UnsupportedOperationException. Empty tags valid; null tags/elements outside domain.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.