Explorar el Código

part 1 complete

Lauren Green hace 6 años
padre
commit
4489906e58

+ 13
- 0
src/main/java/org/zipcoder/store/Cart.java Ver fichero

@@ -12,4 +12,17 @@ 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
+        return Objects.hash(id);
27
+    }
15 28
 }

+ 3
- 2
src/main/java/org/zipcoder/store/User.java Ver fichero

@@ -55,8 +55,9 @@ public class User {
55 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
 }