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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java

Issue 2152323002: Remove Comparable interface from UrlInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java
index 3bc48db1937054362fe107873cc03bffabdf27e6..76a34fc10326c3dadc18c315a61b9af9749375a3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java
@@ -12,7 +12,7 @@ import java.util.Locale;
/**
* This class represents a scanned URL and information associated with that URL.
*/
-class UrlInfo implements Comparable<UrlInfo> {
+class UrlInfo {
private static final String URL_KEY = "url";
private static final String DISTANCE_KEY = "distance";
private static final String SCAN_TIMESTAMP_KEY = "scan_timestamp";
@@ -124,67 +124,6 @@ class UrlInfo implements Comparable<UrlInfo> {
}
/**
- * Returns a hash code for this UrlInfo.
- * @return hash code
- */
- @Override
- public int hashCode() {
- int hash = 31 + mUrl.hashCode();
- hash = hash * 31 + (int) mDistance;
- hash = hash * 31 + (int) mScanTimestamp;
- hash = hash * 31 + (mHasBeenDisplayed ? 1 : 0);
- return hash;
- }
-
- /**
- * Checks if two UrlInfos are equal.
- * @param other the UrlInfo to compare to.
- * @return true if the UrlInfo are equal.
- */
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (other instanceof UrlInfo) {
- UrlInfo urlInfo = (UrlInfo) other;
- return compareTo(urlInfo) == 0;
- }
- return false;
- }
-
- /**
- * Compares two UrlInfos.
- * @param other the UrlInfo to compare to.
- * @return the comparison value.
- */
- @Override
- public int compareTo(UrlInfo other) {
- int compareValue = mUrl.compareTo(other.mUrl);
- if (compareValue != 0) {
- return compareValue;
- }
-
- compareValue = Double.compare(mDistance, other.mDistance);
- if (compareValue != 0) {
- return compareValue;
- }
-
- compareValue = Long.compare(mScanTimestamp, other.mScanTimestamp);
- if (compareValue != 0) {
- return compareValue;
- }
-
- compareValue = Boolean.compare(mHasBeenDisplayed, mHasBeenDisplayed);
- if (compareValue != 0) {
- return compareValue;
- }
-
- return 0;
- }
-
- /**
* Represents the UrlInfo as a String.
*/
@Override
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698