title: Do any Java libraries provide a random access Queue implementation?
body: <p>I'm implementing a sliding window over a stream of events, in Java.
  So I want a data structure which allows me to do the following:</p>
  
  <ol>
  <li><p>add to the end of the data structure when new events occur;</p></li>
  <li><p>remove from the start of the data structure when old events are processed;</p></li>
  <li><p>get standard random access (<code>size()</code>, <code>get(i)</code>) to the elements of the data structure; in general, typical <a href="http://java.sun.com/javase/6/docs/api/java/util/List.html" rel="nofollow noreferrer">List</a> "read" operations;</p></li>
  <li><p>is efficient for all of the above operations;</p></li>
  <li><p>is unbounded.</p></li>
  </ol>
  
  <p>No other access is required. And no thread safety is required.</p>
  
  <p>I'm currently doing this with an <a href="http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html" rel="nofollow noreferrer">ArrayList</a>, to get things up and running. But I want something more efficient; the <code>remove(0)</code> method (2. above) is inefficient with an <code>ArrayList</code>.</p>
  
  <p>Numbers 1. and 2. are standard <a href="http://java.sun.com/javase/6/docs/api/java/util/Queue.html" rel="nofollow noreferrer">Queue</a>-style operations. However, the implementations of <code>Queue</code> in the JDK (such as <a href="http://java.sun.com/javase/6/docs/api/java/util/ArrayDeque.html" rel="nofollow noreferrer">ArrayDeque</a>) don't allow for <code>get(i)</code> in 3.</p>
  
  <p>So, I'm wondering if there are any <strong>libraries</strong> out there which have such an implementation, and are suitable for commercial use.</p>
  
  <p>If not, I guess I'll resort to writing my own...</p>