Which action is required by a count algorithm?
Explanation
Sum, average, min, max, and count all combine a traversal with an accumulator: the loop visits the values and the accumulator keeps the result built so far. In countUrgent the accumulator is count, and the helper method isUrgent decides whether the current element deserves an increment.
- B is not correct: Returning at the first match is the any pattern; it stops the traversal early, so no running total is ever built.
- C is not correct: Counting is read-only work that records how many elements match; replacing elements changes the contents of the list instead.
- D is not correct:
size()reports how many elements are stored, not how many of them satisfy the condition being tested.