Browse Source

equals aded

nafis nibir 6 years ago
parent
commit
345d7382d3
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      src/main/java/org/zipcoder/store/User.java

+ 13
- 0
src/main/java/org/zipcoder/store/User.java View File

@@ -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
 }