Skip to content

Commit

Permalink
Add hashCode and equals.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Dec 1, 2024
1 parent c3428ea commit 84ac4bb
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -350,4 +351,27 @@ public Optional<Long> displayPasswordSerial() {
return this.<Number> fromStatus("displayPasswordSerial")
.map(Number::longValue);
}

@Override
public int hashCode() {
return Objects.hash(metadata.getNamespace(), metadata.getName());
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
VmDefinition other = (VmDefinition) obj;
return Objects.equals(metadata.getNamespace(),
other.metadata.getNamespace())
&& Objects.equals(metadata.getName(), other.metadata.getName());
}

}

0 comments on commit 84ac4bb

Please sign in to comment.