Add equals() & hashcode() methods

osx
sgoudham 3 years ago
parent 79dc6e7afb
commit 1ef16260c8
No known key found for this signature in database
GPG Key ID: EF51A29A50FB754C

@ -1,5 +1,7 @@
package me.goudham.model; package me.goudham.model;
import java.util.Objects;
public class MyClipboardContent<T> { public class MyClipboardContent<T> {
private T content; private T content;
@ -14,4 +16,17 @@ public class MyClipboardContent<T> {
public T getContent() { public T getContent() {
return content; return content;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MyClipboardContent<?> that = (MyClipboardContent<?>) o;
return Objects.equals(content, that.content);
}
@Override
public int hashCode() {
return Objects.hash(content);
}
} }

Loading…
Cancel
Save