@SuppressWarnings("unchecked")
    @Override
    public T next() {
        Object result = iterator.next();
        if (result != null) {
            if (!result.getClass().isArray()) {
                result = new Object[]{result};
            }
            return (T) projection.newInstance((Object[]) result);
        } else {
            return null;
        }
    }
{@code TransformingIterator} is a CloseableIterator adapter that transforms via a {@link FactoryExpression} instance

@author tiwe

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