Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator; public class JavaDequedescendingIteratorExample2 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); System.out.println("The list of numbers before using descendingIterator : "); deque.add(20f); deque.add(11f); deque.add(66f); deque.add(89f); deque.add(77f); for (Float integer : deque) { System.out.println(integer); } System.out.println("The list of numbers after using descendingIterator :"); Iterator
iterator= deque.descendingIterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); } } }
Output