com.ajjpj.abase.collection.AEqualsWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of a-base Show documentation
Show all versions of a-base Show documentation
a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations
package com.ajjpj.abase.collection;
/**
* @author arno
*/
public class AEqualsWrapper { //TODO javadoc, junit
private final AEquality equality;
public final T value;
public AEqualsWrapper(AEquality equality, T value) {
this.equality = equality;
this.value = value;
}
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override public boolean equals(Object obj) {
return equality.equals(value, obj);
}
@Override public int hashCode() {
return equality.hashCode(value);
}
@Override
public String toString() {
return value.toString();
}
}