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,17 +1,32 @@
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;
public MyClipboardContent(T content) {
this.content = content;
}
public void setContent(Object content) {
this.content = (T) content;
}
public MyClipboardContent(T content) { public T getContent() {
this.content = content; return content;
} }
public void setContent(Object content) { @Override
this.content = (T) content; 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);
}
public T getContent() { @Override
return content; public int hashCode() {
} return Objects.hash(content);
}
} }

Loading…
Cancel
Save