This commit is contained in:
Rossen Stoyanchev 2017-08-14 18:55:39 +03:00
parent 8c4b1ab781
commit 280c64ba35
1 changed files with 8 additions and 3 deletions

View File

@ -706,8 +706,13 @@ public class PathPattern implements Comparable<PathPattern> {
Comparator.nullsLast(
Comparator.<PathPattern>
comparingInt(p -> p.isCatchAll() ? 1 : 0)
.thenComparingInt(p -> p.isCatchAll() ? -1 * p.getNormalizedLength() : 0)
.thenComparing(PathPattern::getScore)
.thenComparingInt(p -> -1 * p.getNormalizedLength())
.thenComparingInt(p -> p.isCatchAll() ? scoreByNormalizedLength(p) : 0)
.thenComparingInt(PathPattern::getScore)
.thenComparingInt(PathPattern::scoreByNormalizedLength)
);
private static int scoreByNormalizedLength(PathPattern pattern) {
return -pattern.getNormalizedLength();
}
}