mirror of
https://github.com/androidx/media.git
synced 2025-05-11 09:39:52 +08:00
Document the reason for defining private method defaultIfNull
PiperOrigin-RevId: 495004732 (cherry picked from commit c3ca71fda738772dccc5a5e07293c884d2194f0a)
This commit is contained in:
parent
47b811e3b9
commit
aa2158d5c8
@ -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}.
|
||||
*
|
||||
* <p>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> T defaultIfNull(@Nullable T value, @Nullable T defaultValue) {
|
||||
return value != null ? value : defaultValue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user