Fixing equals and dashcode for download and history items
This commit is contained in:
parent
8a58fe9f8c
commit
5f871787a5
@ -120,27 +120,30 @@ public class HistoryItem implements Comparable<HistoryItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object object) {
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
if (this == object) return true;
|
HistoryItem that = (HistoryItem) o;
|
||||||
if (object == null) return false;
|
|
||||||
if (!(object instanceof HistoryItem)) return false;
|
|
||||||
|
|
||||||
HistoryItem that = (HistoryItem) object;
|
if (mImageId != that.mImageId) return false;
|
||||||
|
if (mPosition != that.mPosition) return false;
|
||||||
|
if (mIsFolder != that.mIsFolder) return false;
|
||||||
|
if (!mUrl.equals(that.mUrl)) return false;
|
||||||
|
if (!mTitle.equals(that.mTitle)) return false;
|
||||||
|
|
||||||
|
return mFolder.equals(that.mFolder);
|
||||||
|
|
||||||
return mImageId == that.mImageId &&
|
|
||||||
this.mTitle.equals(that.mTitle) && this.mUrl.equals(that.mUrl) &&
|
|
||||||
this.mFolder.equals(that.mFolder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
||||||
int result = mUrl.hashCode();
|
int result = mUrl.hashCode();
|
||||||
result = 31 * result + mImageId;
|
|
||||||
result = 31 * result + mTitle.hashCode();
|
result = 31 * result + mTitle.hashCode();
|
||||||
result = 32 * result + mFolder.hashCode();
|
result = 31 * result + mFolder.hashCode();
|
||||||
result = 31 * result + mImageId;
|
result = 31 * result + mImageId;
|
||||||
|
result = 31 * result + mPosition;
|
||||||
|
result = 31 * result + (mIsFolder ? 1 : 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -70,23 +70,24 @@ public class DownloadItem implements Comparable<DownloadItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object object) {
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
if (this == object) return true;
|
DownloadItem that = (DownloadItem) o;
|
||||||
if (object == null) return false;
|
|
||||||
if (!(object instanceof DownloadItem)) return false;
|
|
||||||
|
|
||||||
DownloadItem that = (DownloadItem) object;
|
if (!mUrl.equals(that.mUrl)) return false;
|
||||||
|
if (!mTitle.equals(that.mTitle)) return false;
|
||||||
|
|
||||||
|
return mContentSize.equals(that.mContentSize);
|
||||||
|
|
||||||
return this.mTitle.equals(that.mTitle) && this.mUrl.equals(that.mUrl)
|
|
||||||
&& this.mContentSize.equals(that.mContentSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
||||||
int result = mUrl.hashCode();
|
int result = mUrl.hashCode();
|
||||||
result = 31 * result + mTitle.hashCode();
|
result = 31 * result + mTitle.hashCode();
|
||||||
|
result = 31 * result + mContentSize.hashCode();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user