Эх сурвалжийг харах

codacy: Ensure you override both equals() and hashCode()

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 5 жил өмнө
parent
commit
670e9d3a61

+ 7 - 0
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java

@@ -84,10 +84,12 @@ import org.jetbrains.annotations.NotNull;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 import javax.inject.Inject;
@@ -500,6 +502,11 @@ public class ContactListFragment extends FileFragment implements Injectable {
         public String toString() {
             return displayName;
         }
+
+        @Override
+        public int hashCode() {
+            return Arrays.hashCode(new Object[] {displayName, name, type});
+        }
     }
 
     private class DownloadFinishReceiver extends BroadcastReceiver {