Actually there is no need to use flatMap

`null` values returned in the lambda are converted to empty `Optional`s in the `map` method: https://developer.android.com/reference/java/util/Optional#map(java.util.function.Function%3C?%20super%20T,%20?%20extends%20U%3E)
This commit is contained in:
Stypox 2023-01-11 15:26:46 +01:00
parent 0f0a1d36d8
commit b6b09b68af
3 changed files with 5 additions and 4 deletions

View file

@ -1887,7 +1887,7 @@ public final class VideoDetailFragment
setupBrightness();
if (!isPlayerAndPlayerServiceAvailable()
|| player.UIs().get(MainPlayerUi.class).isEmpty()
|| getRoot().flatMap(v -> Optional.ofNullable(v.getParent())).isEmpty()) {
|| getRoot().map(View::getParent).isEmpty()) {
return;
}