Commit aa2158d5 by rohks Committed by christosts

Document the reason for defining private method `defaultIfNull`

PiperOrigin-RevId: 495004732
(cherry picked from commit c3ca71fd)
parent 47b811e3
......@@ -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