Use Version.compareTo when calculating minimum version (elastic/elasticsearch#4505)

Results from elasticsearch change elastic/elasticsearch#22378 (6ad5486)

Original commit: elastic/x-pack-elasticsearch@73c09657bb
This commit is contained in:
Tim Vernum 2017-01-05 17:43:10 +11:00 committed by GitHub
parent ca3bbc7da0
commit c64ad22579
1 changed files with 1 additions and 10 deletions

View File

@ -41,7 +41,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@ -241,15 +240,7 @@ public class SecurityTemplateService extends AbstractComponent implements Cluste
public static Version oldestSecurityIndexMappingVersion(ClusterState clusterState, Logger logger) {
final Set<Version> versions = securityIndexMappingVersions(clusterState, logger);
return versions.stream().min((o1, o2) -> {
if(o1.before(o2)) {
return -1;
}
if(o1.after(o2)) {
return +1;
}
return 0;
}).orElse(null);
return versions.stream().min(Version::compareTo).orElse(null);
}
private static Set<Version> securityIndexMappingVersions(ClusterState clusterState, Logger logger) {