@Override public final T get() throws IOException { if(i == size) { if(loadMore() <= 0) { throw new EOFException(); } } return items.get(i ++); }
@Override public final int get(final List<T> buffer, final int maxCount) throws IOException { int n = size - i; if(n == 0) { if(loadMore() <= 0) { throw new EOFException(); } } n = Math.min(size - i, maxCount); for(int j = i; j < i + n; j ++) { buffer.add(items.get(j)); } i += n; return n; }