I want to return an "Relation" using the default method "negate()", which always returns the opposite of the method test(). How can I do that?
public interface Relation<X,Y> {
    boolean test(X x, Y y);
    default Relation<X,Y> negate() {
        // TODO
        Relation<X, Y> relation = new Relation<X, Y>() {
            public boolean test(X x, Y y) {
                return !this.test(x, y);
            }
            
        };
        return relation;
    }
}
I tried this code however it gives me stack overflow error
 
    