use of org.bf2.cos.fleetshard.api.VersionRange in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class OperatorSelectorUtil method available.
public static Optional<Operator> available(OperatorSelector selector, Collection<Operator> operators) {
if (operators == null) {
return Optional.empty();
}
if (operators.isEmpty()) {
return Optional.empty();
}
final VersionRange range = new VersionRange(selector.getVersion());
final Comparator<Operator> cmp = Comparator.comparing(o -> new Version(o.getVersion()));
return operators.stream().filter(o -> Objects.equals(o.getType(), selector.getType())).filter(o -> versionInRange(range, o)).max(cmp);
}
Aggregations