1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-21 15:28:52 -05:00

Simplify by not using Optional

This commit is contained in:
Reinhard Pointner 2019-06-10 17:07:37 +07:00
parent 8328d0d94b
commit e5ecc6a04f

View File

@ -1,6 +1,5 @@
package net.filebot.web;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
@ -26,9 +25,8 @@ public class MappedEpisode extends Episode {
}
private <T> T getFirst(Function<Episode, T> getter) {
return Optional.ofNullable(getter.apply(mapping)).orElseGet(() -> {
return Optional.ofNullable(getter.apply(getOriginal())).orElse(null);
});
T mappingValue = getter.apply(mapping);
return mappingValue != null ? mappingValue : getter.apply(getOriginal());
}
@Override