ArrayDeque.remove(Object o) has the following syntax.
public boolean remove(Object o)
In the following code shows how to use ArrayDeque.remove(Object o) method.
/*w w w . j ava 2 s .c o m*/ import java.util.ArrayDeque; import java.util.Deque; public class Main { public static void main(String[] args) { Deque<Integer> deque = new ArrayDeque<Integer>(8); deque.add(25); deque.add(2); deque.add(1); deque.add(40); System.out.println(deque); // deque contains element 2, returns true boolean retval = deque.remove(2); if (retval == true) { System.out.println("element 2 is removed from the deque"); } else { System.out.println("element 2 is not contained in the deque"); } System.out.println(deque); } }
The code above generates the following result.