LinkedBlockingDeque removeIf() method in Java with Examples
The removeIf() method of LinkedBlockingDeque removes the element from this LinkedBlockingDeque that satisfies the specified condition.
public boolean removeIf (Predicate<? super E> filter)
Parameters: This method accepts a mandatory parameter filter which is the predicate value based on which elements are removed from this Deque.
Returns: This method returns a boolean value such as true, if the LinkedBlockingDeque is changed. Else this method returns false.
Exceptions: This method throws NullPointerException if the specified Predicate filter is null.
Below program illustrates the removeIf() function of LinkedBlockingDeque class :
Linked Blocking Deque: [7855642, 35658786, 5278367, 74381793] Linked Blocking Deque: [7855642, 5278367]
Linked Blocking Deque: [7855642, 35658786, 5278367, 74381793] java.lang.NullPointerException
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.