Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequeremoveLastOccurrenceExample2 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.add(23l); deque.add(45l); deque.add(63l); deque.add(45l); boolean val = deque.removeLastOccurrence(55l); System.out.println("The value is already present in the deque : "+val); System.out.println("The final deque is given as : "); for (Long long1 : deque) { System.out.println(long1); } } }
Output