Prototype: offerPrefix(BlockingQueue<Integer> queue,List<Integer> values) -> int offers values in order without waiting, stops at the first false offer, and returns accepted count. Existing contents remain first, input list unchanged; never skip a rejected value and try later values.
Final: publish(BlockingQueue<Integer> queue,List<Integer> values) -> void throws InterruptedException puts every input value in order, waiting for capacity. Do not create an executor or a busy-wait loop. If interrupted while blocked, propagate InterruptedException and leave the already-published prefix committed; do not publish further values. Caller owns queue and producer thread lifetime. Inputs are nonnull integers; queue capacity is >=1.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.