Remove all occurrences of an element from ArrayList
l.removeAll(Collections.singleton("first"));
Another way using Java 8:
l.removeIf("first"::equals);
while(l.remove("first")) { }
This removes all elements "first" from the list.
l.removeAll(Collections.singleton("first"));
Another way using Java 8:
l.removeIf("first"::equals);
while(l.remove("first")) { }
This removes all elements "first" from the list.