Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequePeekLastExample2 { public static void main(String[] args) { int capacity =20; LinkedBlockingDeque
deque1 = new LinkedBlockingDeque
(capacity); LinkedBlockingDeque
deque2 = new LinkedBlockingDeque
(capacity); deque1.add("Keshav"); deque1.add("Naveen"); deque1.add("Neha"); deque1.add("Hitesh"); deque1.add("Surbhi"); deque1.add("Nitin"); deque2.add("Ankit"); deque2.add("Megha"); deque2.add("Janak"); deque2.add("Riya"); System.out.println("Last element of deque1 : "+deque1.peekLast()); System.out.println("Deque1 after peekLast() : "+deque1 +"\n" ); System.out.println("Last element of deque2 : "+deque2.peekLast()); System.out.println("Deque2 after peekLast() : "+deque2); } }
Output