My requirement is I want to write custom Comparator
library such that it can compare two objects return true if they are equal or false
for example
public interface Icomparator<X, Y> {
public boolean compare(X x, Y y);
}
public class ComparatorImpl<X, Y> implements Icomparator<X, Y> {
@override
public boolean compare(X x, Y y) {
// logic for example as below.
if (x == y)
return true;
return false;
}
}
How this could be used to compare two objects and how this will be called to compare any two objects.