Lauren Green 6 anni fa
parent
commit
4489906e58

+ 13
- 0
src/main/java/org/zipcoder/store/Cart.java Vedi File

12
     public long getId(){
12
     public long getId(){
13
         return this.id;
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
+        return Objects.hash(id);
27
+    }
15
 }
28
 }

+ 3
- 2
src/main/java/org/zipcoder/store/User.java Vedi File

55
         return false;
55
         return false;
56
     }
56
     }
57
 
57
 
58
-    public String hashCode(long id, String name) {
59
-        return
58
+    @Override
59
+    public int hashCode() {
60
+        return Objects.hash(id, name);
60
 
61
 
61
     }
62
     }
62
 }
63
 }