FieldPathIteratorHandler.ModificationStatus iterateSubset(int startPos, int endPos, FieldPath fieldPath, String variable, int nextPos, FieldPathIteratorHandler handler) {
        FieldPathIteratorHandler.ModificationStatus retVal = FieldPathIteratorHandler.ModificationStatus.NOT_MODIFIED;

        LinkedList<Integer> indicesToRemove = new LinkedList<Integer>();

        for (int i = startPos; i <= endPos && i < values.size(); i++) {
            if (variable != null) {
                handler.getVariables().put(variable, new FieldPathIteratorHandler.IndexValue(i));
            }

            FieldValue fv = values.get(i);
            FieldPathIteratorHandler.ModificationStatus status = fv.iterateNested(fieldPath, nextPos, handler);

            if (status == FieldPathIteratorHandler.ModificationStatus.REMOVED) {
                indicesToRemove.addFirst(i);
                retVal = FieldPathIteratorHandler.ModificationStatus.MODIFIED;
            } else if (status == FieldPathIteratorHandler.ModificationStatus.MODIFIED) {
                retVal = status;
            }
        }

        if (variable != null) {
            handler.getVariables().remove(variable);
        }

        for (Integer idx : indicesToRemove) {
            values.remove(idx.intValue());
        }
        return retVal;
    }
FieldValue which encapsulates an Array value

@author Einar M R Rosenvinge
document/src/main/java/com/yahoo/document/datatypes/Array.java