The java.util.concurrent.ConcurrentLinkedDeque.removeFirstOccurrence() method is an in-built method in Java which accepts a parameter and removes the first appearance of that element in the deque. Thus, in case the element is not present in the deque, it remains unchanged.
public boolean removeFirstOccurrence(Object o)
Parameters: The function accepts an object elem as parameter which denotes the object whose first appearance from the deque is to be removed.
Return Value: The function returns true if elem is present in th edeque and returns false otherwise.
Exception: The function throws NullPointerException if the specified element passed as parameter to the function is null.
Below programs illustrate the use of removeFirstOccurrence() method :
Elements in the LinkedDeque: [Geeks, gfg, Gfg, Geeks, GFG] Elements in the LinkedDeque: [gfg, Gfg, Geeks, GFG]
Elements in the LinkedDeque: [379, 1050, 1008, 280, 12] java.lang.NullPointerException
- ArrayDeque removeFirstOccurrence() Method in Java
- LinkedList removeFirstOccurrence() Method in Java
- LinkedBlockingDeque removeFirstOccurrence() method in Java
- BlockingDeque removeFirstOccurrence() method in Java with Examples
- ConcurrentLinkedDeque add() method in Java
- ConcurrentLinkedDeque descendingIterator() method in Java with Example
- ConcurrentLinkedDeque iterator() method in Java with Example
- ConcurrentLinkedDeque element() method in Java
- ConcurrentLinkedDeque size() method in Java
- ConcurrentLinkedDeque removeLastOccurrence() Method in Java
- ConcurrentLinkedDeque pop() method in Java with Examples
- ConcurrentLinkedDeque hashCode() method in Java with Example
- ConcurrentLinkedDeque equals() method in Java with Example
- ConcurrentLinkedDeque peekFirst() method in Java
- ConcurrentLinkedDeque addFirst() method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.