Fixed hashCode and equals collisions
This commit is contained in:
parent
c42dc60af1
commit
0d3e1df6e5
@ -10,6 +10,7 @@ import ru.dragonestia.picker.api.repository.type.RoomPath;
|
||||
import java.beans.Transient;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Schema(title = "Room")
|
||||
public class ResponseRoom implements IRoom {
|
||||
@ -116,7 +117,7 @@ public class ResponseRoom implements IRoom {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
return Objects.hash(id, nodeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,7 +125,7 @@ public class ResponseRoom implements IRoom {
|
||||
if (object == this) return true;
|
||||
if (object == null) return false;
|
||||
if (object instanceof ResponseRoom other) {
|
||||
return id.equals(other.id);
|
||||
return id.equals(other.id) && nodeId.equals(other.nodeId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import ru.dragonestia.picker.api.repository.type.RoomPath;
|
||||
import java.beans.Transient;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Schema(title = "Room (Short)")
|
||||
public class ShortResponseRoom implements IRoom {
|
||||
@ -92,7 +93,7 @@ public class ShortResponseRoom implements IRoom {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
return Objects.hash(id, nodeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,7 +101,7 @@ public class ShortResponseRoom implements IRoom {
|
||||
if (object == this) return true;
|
||||
if (object == null) return false;
|
||||
if (object instanceof ShortResponseRoom other) {
|
||||
return id.equals(other.id);
|
||||
return id.equals(other.id) && nodeId.equals(other.nodeId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user