}
return min;
} else if(firstItem instanceof DurationValue) {
// Duration values must either all be xdt:yearMonthDuration values
// or must all be xdt:dayTimeDuration values.
DurationValue min = (DurationValue) firstItem;
assert (firstType != null);
while(argItor.hasNext()) {
Item it = argItor.next();
if(it instanceof DurationValue) {
throw new DynamicError("err:FORG0006", "Duration values must all be `"
+ firstType + "`, but found `" + it.getType() + "`");
}
DurationValue cmp = (DurationValue) it;
if(cmp.compareTo(min) < 0) {
min = cmp;
}
}
return min;
} else if(TypeUtil.subtypeOf(firstType, StringType.STRING)) {