Online Java Compiler By
JavaTpoint.com
import java.util.Iterator; import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequeIteratorExample1 { static int i = 1; public static void main(String[] args) { int capacity = 100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add("Ram"); deque.add("Sham"); deque.add("Mira"); deque.add("Rajesh"); Iterator
iterator = deque.iterator(); //Returns an iterator over the elements while (iterator.hasNext()) { System.out.println(i++ + "." + iterator.next()); } } }
Output