nafis nibir 6 lat temu
rodzic
commit
345d7382d3
1 zmienionych plików z 13 dodań i 0 usunięć
  1. 13
    0
      src/main/java/org/zipcoder/store/User.java

+ 13
- 0
src/main/java/org/zipcoder/store/User.java Wyświetl plik

@@ -37,4 +37,17 @@ public class User {
37 37
     public void setName(String name) {
38 38
         this.name = name;
39 39
     }
40
+
41
+    public boolean equals(User user){
42
+        if(user.getName() == null){
43
+            if (user.getId() == this.getId()){
44
+                return true;
45
+            }
46
+            return false;
47
+        }
48
+        if (user.getId() == this.getId() && user.getName().equals(this.getName())){
49
+            return true;
50
+        }
51
+        return false;
52
+    }
40 53
 }