title: How do I shuffle a deque?
body: <p>This is my code:</p>
  
  <pre><code>import java.util.ArrayDeque;
  import java.util.Collections;
  import java.util.Deque;
  import java.util.List;
  
  public class ArrayDequeDemo {
     public static void main(String[] args) {
  
        // create an empty array deque with an initial capacity
        Deque&lt;Integer&gt; deque = new ArrayDeque&lt;Integer&gt;(8);
  
        // use add() method to add elements in the deque
        deque.add(15);
        deque.add(30);
        deque.add(20);
        deque.add(18);        
  
        // let us print all the elements available in deque
        for (Integer number : deque) {
           System.out.println("Number = " + number);
        }
  
        //Collections.shuffle((List&lt;?&gt;) deque);
        // getFirst() will retrieve element at first(head) position
        int retval = deque.getFirst();
        System.out.println("Retrieved Element is = " + retval);
     }
  }
  </code></pre>
  
  <p>I know how to shuffle a <code>List</code>, but how do I use the <code>Collections</code> to shuffle a deque?
  Please reply with code as I am not totally used to Java terms/theory, I am still learning.</p>