in maven-resolver-util/src/main/java/org/eclipse/aether/util/version/UnionVersionRange.java [66:105]
private UnionVersionRange(Collection<? extends VersionRange> ranges) {
if (ranges == null || ranges.isEmpty()) {
this.ranges = Collections.emptySet();
lowerBound = null;
upperBound = null;
} else {
this.ranges = new HashSet<>(ranges);
Bound lowerBound = null, upperBound = null;
for (VersionRange range : this.ranges) {
Bound lb = range.getLowerBound();
if (lb == null) {
lowerBound = null;
break;
} else if (lowerBound == null) {
lowerBound = lb;
} else {
int c = lb.getVersion().compareTo(lowerBound.getVersion());
if (c < 0 || (c == 0 && !lowerBound.isInclusive())) {
lowerBound = lb;
}
}
}
for (VersionRange range : this.ranges) {
Bound ub = range.getUpperBound();
if (ub == null) {
upperBound = null;
break;
} else if (upperBound == null) {
upperBound = ub;
} else {
int c = ub.getVersion().compareTo(upperBound.getVersion());
if (c > 0 || (c == 0 && !upperBound.isInclusive())) {
upperBound = ub;
}
}
}
this.lowerBound = lowerBound;
this.upperBound = upperBound;
}
}