ObjectQueue implements Iterable<T>, Closeable { public abstract void add(T entry) throws IOException;  static ObjectQueue<T> create(QueueFile qf, Converter<T> converter); static ObjectQueue<T> createInMemory(); abstract @Nullable QueueFile file(); abstract int size(); boolean isEmpty(); abstract void add(T entry); abstract @Nullable T peek(); List<T> peek(int max); List<T> asList(); void remove(); abstract void remove(int n); void clear();  }
@Test public void testIterator() throws IOException { final List<String> saw = new ArrayList<>(); for (String pojo : queue) { saw.add(pojo); } assertThat(saw).containsExactly("one", "two", "three"); }