I currently have a List
of Objects. Removal of an object is done via:
if (mProducts.contains(orderProduct)) {
mProducts.remove(orderProduct);
.
.
However the javadocs for List
states
Removes the first occurrence of the specified object from this {@code List}.
I need to remove the given object from the list and NOT just the first object. What is the correct approach here? Can I provide my own implementation of List.remove or use an alternative data structure?
Thanks, Otterman