Online Java Compiler By
JavaTpoint.com
import java.util.Iterator; import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequeDescendingIteratorExample2 { public static void main(String[] args) { LinkedBlockingDeque
deque = new LinkedBlockingDeque
(); for (char c ='A';c<='Z';c++){ deque.add(c); } System.out.println("Characters : "); System.out.print("["); for (Character ch : deque){ System.out.print(ch +","); } System.out.println("]"); System.out.println("After reversing the characters : "); //returns an iterator over the elements in this deque in reverse sequential order Iterator it = deque.descendingIterator(); System.out.print("["); while (it.hasNext()) { System.out.print(it.next()+","); } System.out.println("]"); } }
Output