Commit c3ca71fd by rohks Committed by Ian Baker

Document the reason for defining private method `defaultIfNull`

PiperOrigin-RevId: 495004732
parent 339ce4fc
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment