Prototype: availableCopies(List<CopyState>,title) filters available exact-title copies and returns sorted IDs; assume valid inputs, preserve them.
Final: Library(List<BookCopy>) validates unique nonempty IDs and nonempty titles. All method IDs/titles are nonempty. borrow(memberId,title) returns the smallest free copy ID or null, and rejects a duplicate active title for that member. returnCopy(copyId,memberId) returns false if absent, raises for wrong owner, otherwise releases once. available(title) and loans() return fresh sorted snapshots (copy-ID order).
The complete public API is in Exercise.java. All domain classes are public static nested classes of Exercise; construct them as new Exercise.ClassName(...). Do not implement a solution in the test runner. Each instance owns independent state. Unless explicitly allowed, null inputs are outside the domain. Failed operations leave state unchanged; validation happens before mutation.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.