diff --git a/android/guava/src/com/google/common/collect/ImmutableMap.java b/android/guava/src/com/google/common/collect/ImmutableMap.java index 23da89269256..f8d2ade49b49 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMap.java @@ -500,6 +500,23 @@ public boolean containsValue(@Nullable Object value) { @Override public abstract V get(@Nullable Object key); + /** + * {@inheritDoc} + * + *
See {@code
+ * Map.getOrDefault}.
+ *
+ * @since 23.5 (but since 21.0 in the JRE flavor).
+ * Note that API Level 24 users can call this method with any version of Guava.
+ */
+ // @Override under Java 8 / API Level 24
+ public final V getOrDefault(@Nullable Object key, @Nullable V defaultValue) {
+ V result = get(key);
+ return (result != null) ? result : defaultValue;
+ }
+
@LazyInit private transient ImmutableSet