Add equals() & hashcode() methods
parent
79dc6e7afb
commit
1ef16260c8
@ -1,17 +1,32 @@
|
||||
package me.goudham.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
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) {
|
||||
this.content = content;
|
||||
}
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(Object content) {
|
||||
this.content = (T) 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);
|
||||
}
|
||||
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(content);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue