Update EqualsWrapper.java

This commit is contained in:
Andrea Cavalli 2020-10-14 21:42:57 +02:00
parent fe52292587
commit 4ee7c8c2a4

View 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);
}
}