in bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeImpl.java [143:165]
private static int compareIterability(Node quid, Node quo, boolean strict) {
if (quid.isInIterable()) {
if (quo.isInIterable()) {
if (quid.getKey() != null) {
return Comparator.comparing(Node::getKey, KEY_COMPARATOR).compare(quid, quo);
}
if (quo.getKey() != null) {
return -1;
}
if (quid.getIndex() == null) {
if (strict) {
// this method cannot consistently order iterables without key or index; the first argument is
// always assumed to be less:
return -1;
}
return quo.getIndex() == null ? 0 : -1;
}
return quo.getIndex() == null ? 1 : quid.getIndex().compareTo(quo.getIndex());
}
return 1;
}
return quo.isInIterable() ? -1 : 0;
}