Instead of partitioning and putting back, will using a version of trimTo that takes in a predicate work better?
That version could trim all elements that satisfy the predicate.

Or am I missing any queue semantics here?