@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Device device = (Device) o; return deviceId == device.getDeviceId(); }
@Override public int compareTo(Device device) { // Device name is null if (device.getName() == null) { return getName().compareTo(""); } // Compare device names else { return getName().compareTo(device.getName()); } }