Iterator<JSONSchema> tupleIter = _items.iterator();
Iterator collIter = coll.iterator();
int index = 0;
while (tupleIter.hasNext() && collIter.hasNext()) {
JSONSchema tupleSchema = tupleIter.next();
Object tupleObj = collIter.next();
hasDuplicates = hasDuplicates || !set.add(tupleObj);
tupleSchema.validate(tupleObj, path + "[" + index + "]", results);
index++;
}
if (_additionalItemsSchema != null) {
while (collIter.hasNext()) {
Object additionalObj = collIter.next();
hasDuplicates = hasDuplicates || !set.add(additionalObj);
_additionalItemsSchema.validate(additionalObj, path + "[" + index + "]", results);
index++;
}
} else if (collIter.hasNext()) {
results.addResult(new ValidationResult().type(ResultType.CONSTRAINT_VIOLATION).path(path).message("Tuple does not allow additional items: " + coll));
}
} else {
int index = 0;
JSONSchema itemSchema = getItem();
for (final Object collObj : coll) {
hasDuplicates = hasDuplicates || !set.add(collObj);
itemSchema.validate(collObj, path + "[" + index + "]", results);
index++;
}
}