@Test public void ensureArtInfoHashCodeWorks() { assertThat(artInfo1.hashCode()).isEqualTo(artInfo1_copy.hashCode()); assertThat(artInfo1.hashCode()).isNotEqualTo(artInfo2.hashCode()); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (artistName == null ? 0 : artistName.hashCode()); result = prime * result + (albumName == null ? 0 : albumName.hashCode()); result = prime * result + (artworkUri == null ? 0 : artworkUri.hashCode()); return result; }
ArtInfo implements Parcelable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (artistName == null ? 0 : artistName.hashCode()); result = prime * result + (albumName == null ? 0 : albumName.hashCode()); result = prime * result + (artworkUri == null ? 0 : artworkUri.hashCode()); return result; } }
ArtInfo implements Parcelable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (artistName == null ? 0 : artistName.hashCode()); result = prime * result + (albumName == null ? 0 : albumName.hashCode()); result = prime * result + (artworkUri == null ? 0 : artworkUri.hashCode()); return result; } ArtInfo(String artistName, String albumName, Uri artworkUri); }
ArtInfo implements Parcelable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (artistName == null ? 0 : artistName.hashCode()); result = prime * result + (albumName == null ? 0 : albumName.hashCode()); result = prime * result + (artworkUri == null ? 0 : artworkUri.hashCode()); return result; } ArtInfo(String artistName, String albumName, Uri artworkUri); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); }
ArtInfo implements Parcelable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (artistName == null ? 0 : artistName.hashCode()); result = prime * result + (albumName == null ? 0 : albumName.hashCode()); result = prime * result + (artworkUri == null ? 0 : artworkUri.hashCode()); return result; } ArtInfo(String artistName, String albumName, Uri artworkUri); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); final String artistName; final String albumName; final Uri artworkUri; static final Creator<ArtInfo> CREATOR; }