1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-21 23:38:50 -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; package net.filebot.web;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
@ -26,9 +25,8 @@ public class MappedEpisode extends Episode {
} }
private <T> T getFirst(Function<Episode, T> getter) { private <T> T getFirst(Function<Episode, T> getter) {
return Optional.ofNullable(getter.apply(mapping)).orElseGet(() -> { T mappingValue = getter.apply(mapping);
return Optional.ofNullable(getter.apply(getOriginal())).orElse(null); return mappingValue != null ? mappingValue : getter.apply(getOriginal());
});
} }
@Override @Override