Browse Source

cart done

nafis nibir 6 years ago
parent
commit
091e6c799f

+ 15
- 0
src/main/java/org/zipcoder/store/Cart.java View File

@@ -12,4 +12,19 @@ public class Cart {
12 12
     public long getId(){
13 13
         return this.id;
14 14
     }
15
+
16
+    @Override
17
+    public boolean equals(Object o) {
18
+        if (this == o) return true;
19
+        if (o == null || getClass() != o.getClass()) return false;
20
+        Cart cart = (Cart) o;
21
+        return id == cart.id;
22
+    }
23
+
24
+    @Override
25
+    public int hashCode() {
26
+
27
+        return Objects.hash(id);
28
+    }
29
+
15 30
 }

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

@@ -50,4 +50,8 @@ public class User {
50 50
         }
51 51
         return false;
52 52
     }
53
+
54
+    public int hashCode(){
55
+        return Objects.hash(this.getId(), this.getName());
56
+    }
53 57
 }