Although the thread is quite old, still thought to provide solution - using Java8
.
Make the use of removeIf
function. Time complexity is O(n)
producersProcedureActive.removeIf(producer -> producer.getPod().equals(pod));
API reference: removeIf docs
Assumption: producersProcedureActive
is a List
NOTE: With this approach you won't be able to get the hold of the deleted item.