changeable equals and hashcode added

This commit is contained in:
Gavriil Sitnikov 2016-09-06 02:34:22 +03:00
parent 8ecbc0fb33
commit c82002c659
1 changed files with 15 additions and 0 deletions

View File

@ -83,4 +83,19 @@ public class Changeable<T> implements Serializable {
subject = BehaviorSubject.create((T) inputStream.readObject());
}
@Override
public boolean equals(final Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
final Changeable<?> that = (Changeable<?>) object;
return subject.getValue() != null ? subject.getValue().equals(that.subject.getValue()) : that.subject.getValue() == null;
}
@Override
public int hashCode() {
return subject.getValue() != null ? subject.getValue().hashCode() : 0;
}
}