From 610e431c906d71fd684c5c7c8ff8a9aa171a55ef 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 --- .../src/main/java/androidx/media3/common/Format.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/common/src/main/java/androidx/media3/common/Format.java b/libraries/common/src/main/java/androidx/media3/common/Format.java index bb712e2472..8e08993f1a 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Format.java +++ b/libraries/common/src/main/java/androidx/media3/common/Format.java @@ -1690,6 +1690,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;