title: ArrayList to emulate a queue - Java
body: <p>I want to use an ArrayList in Java and implement it as a queue. Adding to the queue should be fairly easy using <code>queue.add("element")</code>. Although, removing popping items out it a bit trickier. The way I thought of doing it is the following:</p>
  
  <pre><code>public String pop(){
      String s = queue.get(0);
      queue.remove(0);
      queue.trimToSize();
      return s;
  }
  </code></pre>
  
  <p>is this the right way? will I be getting the next element of the queue next time I invoke the pop() method?</p>