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

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

Issue 2628463005: [Payments] Add compareBoolean for consistence (Closed)
Patch Set: address comments Created 3 years, 11 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 | chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java » ('j') | 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 5286a075818f5de107797f55db95e5743c2ad0f7..3d8ef6f6e593a5cd890b692137935e8ae451beda 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -44,14 +44,19 @@ public class ApiCompatibilityUtils {
}
/**
- * @see Long#compare(long, long)
+ * Compares two long values numerically. The value returned is identical to what would be
+ * returned by {@link Long#compare(long, long)} which is available since API level 19.
*/
public static int compareLong(long lhs, long rhs) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- return Long.compare(lhs, rhs);
- } else {
- return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
- }
+ return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
+ }
+
+ /**
+ * Compares two boolean values. The value returned is identical to what would be returned by
+ * {@link Boolean#compare(boolean, boolean)} which is available since API level 19.
+ */
+ public static int compareBoolean(boolean lhs, boolean rhs) {
+ return lhs == rhs ? 0 : lhs ? 1 : -1;
}
/**
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698