java 8 remove element from list if exists in set code example

Example 1: java 8 list stream delete by name

itemList.removeIf(item -> item.getName().equals("Bug"));

Example 2: java stream remove

// there is no meaning to remove an item from a stream
// It only make sense to remove an item from a collection.
// Internally, removeIf uses an Iterator to iterate over the list and match 
// the elements using the predicate
itemList.removeIf(isQualified);

Tags:

Java Example