From aa2158d5c841e6a17d0d6376d0df7fe56897fbaa Mon Sep 17 00:00:00 2001 From: rohks Date: Tue, 13 Dec 2022 14:27:54 +0000 Subject: [PATCH] Document the reason for defining private method `defaultIfNull` PiperOrigin-RevId: 495004732 (cherry picked from commit c3ca71fda738772dccc5a5e07293c884d2194f0a) --- .../main/java/com/google/android/exoplayer2/Format.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/Format.java b/library/common/src/main/java/com/google/android/exoplayer2/Format.java index ea3b552e1d..e55d17490a 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/Format.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/Format.java @@ -1668,6 +1668,14 @@ public final class Format implements Bundleable { + Integer.toString(initialisationDataIndex, Character.MAX_RADIX); } + /** + * Utility method to get {@code defaultValue} if {@code value} is {@code null}. {@code + * defaultValue} can be {@code null}. + * + *

Note: Current implementations of getters in {@link Bundle}, for example {@link + * Bundle#getString(String, String)} does not allow the defaultValue to be {@code null}, hence the + * need for this method. + */ @Nullable private static T defaultIfNull(@Nullable T value, @Nullable T defaultValue) { return value != null ? value : defaultValue;