diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/resources/Resources.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java b/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java index 5f7e2606..d3f6de94 100644 --- a/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java +++ b/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java @@ -3,6 +3,7 @@ package org.luxons.sevenwonders.game.resources; import java.util.EnumMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; public class Resources { @@ -44,4 +45,21 @@ public class Resources { public boolean isEmpty() { return quantities.values().stream().reduce(0, Integer::sum) == 0; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Resources resources = (Resources)o; + return Objects.equals(quantities, resources.quantities); + } + + @Override + public int hashCode() { + return Objects.hash(quantities); + } } |