mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
Refactor OriginalOrder
This commit is contained in:
parent
2eaac2eab8
commit
b1d48fe590
@ -54,7 +54,7 @@ class AutoDetectMatcher implements AutoCompleteMatcher {
|
||||
log.log(Level.WARNING, "Failed group: " + it.getKey(), e);
|
||||
return Stream.empty();
|
||||
}
|
||||
}).sorted(comparing(Match::getValue, new OriginalOrder<File>(files))).collect(toList());
|
||||
}).sorted(comparing(Match::getValue, OriginalOrder.of(files))).collect(toList());
|
||||
} finally {
|
||||
workerThreadPool.shutdownNow();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||
matches.addAll(derivateMatches);
|
||||
|
||||
// restore original order
|
||||
matches.sort(comparing(Match::getValue, new OriginalOrder<File>(files)));
|
||||
matches.sort(comparing(Match::getValue, OriginalOrder.of(files)));
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ class MovieMatcher implements AutoCompleteMatcher {
|
||||
});
|
||||
|
||||
// restore original order
|
||||
matches.sort(comparing(Match::getValue, new OriginalOrder<File>(files)));
|
||||
matches.sort(comparing(Match::getValue, OriginalOrder.of(files)));
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
@ -7,6 +7,10 @@ import java.util.Map;
|
||||
|
||||
class OriginalOrder<T> implements Comparator<T> {
|
||||
|
||||
public static <T> Comparator<T> of(Collection<T> values) {
|
||||
return new OriginalOrder(values);
|
||||
}
|
||||
|
||||
private Map<T, Integer> index;
|
||||
|
||||
public OriginalOrder(Collection<T> values) {
|
||||
|
Loading…
Reference in New Issue
Block a user