@Override
    public T next() {
        T rval = resource;
        if (rval == null) {
            rval = nextResource();
            if (rval == null) {
                throw new NoSuchElementException("No more elements");
            }
        } else {
            resource = null;
        }
        return rval;
    }
Used to iterate through a list of resources already retrieved.
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/internal/IteratorSupport.java