override hash and equals function in Device to avoid duplicates in collections

4.x.x
Lakshman 9 years ago
parent a192bfa85c
commit 7174d000e0

@ -147,4 +147,21 @@ public class Device implements Serializable{
"]"; "]";
} }
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Device))
return false;
Device device = (Device) o;
return getDeviceIdentifier().equals(device.getDeviceIdentifier());
}
@Override
public int hashCode() {
return getDeviceIdentifier().hashCode();
}
} }

Loading…
Cancel
Save