mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Document the reason for defining private method defaultIfNull
PiperOrigin-RevId: 495004732
This commit is contained in:
parent
339ce4fced
commit
c3ca71fda7
1 changed files with 8 additions and 0 deletions
|
|
@ -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…
Reference in a new issue