Spotbugs: proper equals and hashCode

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-12-28 12:00:35 +01:00
parent bf8c113f9a
commit 093e6a15bc
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -28,6 +28,7 @@ import com.nextcloud.talk.R;
import com.nextcloud.talk.databinding.RvItemNotificationSoundBinding;
import java.util.List;
import java.util.Objects;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
@ -54,7 +55,26 @@ public class NotificationSoundItem extends AbstractFlexibleItem<NotificationSoun
@Override
public boolean equals(Object o) {
return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NotificationSoundItem that = (NotificationSoundItem) o;
if (!Objects.equals(notificationSoundName, that.notificationSoundName)) {
return false;
}
return Objects.equals(notificationSoundUri, that.notificationSoundUri);
}
@Override
public int hashCode() {
int result = notificationSoundName != null ? notificationSoundName.hashCode() : 0;
result = 31 * result + (notificationSoundUri != null ? notificationSoundUri.hashCode() : 0);
return result;
}
@Override