Update EqualsWrapper.java
This commit is contained in:
parent
fe52292587
commit
4ee7c8c2a4
35
src/main/java/org/warp/commonutils/type/EqualsWrapper.java
Normal file
35
src/main/java/org/warp/commonutils/type/EqualsWrapper.java
Normal file
@ -0,0 +1,35 @@
|
||||
package org.warp.commonutils.type;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class EqualsWrapper<T> {
|
||||
|
||||
private final T value;
|
||||
private final Object equal;
|
||||
|
||||
public EqualsWrapper(T value, Object equal) {
|
||||
this.value = value;
|
||||
this.equal = equal;
|
||||
}
|
||||
|
||||
public T get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
EqualsWrapper<?> that = (EqualsWrapper<?>) o;
|
||||
return Objects.equals(equal, that.equal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(equal);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user