Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java

Issue 2733363003: Introduce objectEquals for null-safe equality check (Closed)
Patch Set: Add @see annotation Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index 825bce7cc860035fffd2b4d64372d4277bfa1039..f773859b842dd295f56901844e80477a0e20d362 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -639,4 +639,13 @@ public class ApiCompatibilityUtils {
window.setFeatureInt(featureNumber, featureValue);
}
}
+
+ /**
+ * Null-safe equivalent of {@code a.equals(b)}.
+ *
+ * @see Objects#equals(Object, Object)
+ */
+ public static boolean objectEquals(Object a, Object b) {
+ return (a == null) ? (b == null) : a.equals(b);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698