@Override
    @SuppressWarnings("unchecked")
    public T next() {
        if (hasNext()) {
            hasNext = null;
            if (asArray) {
                return (T) results.get();
            } else {
                return (T) results.get(0);
            }
        } else {
            throw new NoSuchElementException();
        }
    }
{@code ScrollableResultsIterator} is a {@link CloseableIterator} adapter for ScrollableResults

@author tiwe

@param <T>
querydsl-jpa/src/main/java/com/querydsl/jpa/ScrollableResultsIterator.java