I'm having two collections of Foo. I can not change the implementation of Foo and Foo's equals function is implemented incorrectly. I can also not inherit from Foo. I do custom equality function: I've implemented using guava's Predicate function. To give you an idea, the implementation looks a bit like this.
new Predicate<Pair<Foo, Foo>>() {
@Override
public boolean apply(@Nullable Pair<Foo, Foo> input) {
Foo one = input.getFirst();
Foo two = input.getSecond();
return Objects.equals(one.getId(), two.getId());
}
};
Now I need to check if my two collections of Foo contain the same items ignoring the order
I'm looking for the best way to do this using this custom equality function.