// Path: src/main/java/co/unruly/control/casts/Equality.java
// static <T> boolean areEqual(T self, Object other, BiPredicate<T, T> equalityChecker) {
//     if(self==other) {
//         return true;
//     }
// 
//     if(other==null) {
//         return false;
//     }
// 
//     return pipe(other)
//         .then(exactCastTo((Class<T>)self.getClass()))
//         .then(onSuccess(o -> equalityChecker.test(self, o)))
//         .then(ifFailed(__ -> false))
//         .resolve();
// }


import java.util.Objects;
import static co.unruly.control.casts.Equality.areEqual;
package examples;



/**
 * Just a demonstration of how we can build a cleaner way to check equality
 * using Result-based casts under the hood.
 */
public class ConciseEquals {

    private final int number;
    private final String text;

    public ConciseEquals(int number, String text) {
        this.number = number;
        this.text = text;
    }

//    The best of the IntelliJ inbuilt equality templates
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        ConciseEquals that = (ConciseEquals) o;
//        return number == that.number &&
//            Objects.equals(text, that.text);
//    }

    @Override
    public boolean equals(Object o) {
// Path: src/main/java/co/unruly/control/casts/Equality.java
// static <T> boolean areEqual(T self, Object other, BiPredicate<T, T> equalityChecker) {
//     if(self==other) {
//         return true;
//     }
// 
//     if(other==null) {
//         return false;
//     }
// 
//     return pipe(other)
//         .then(exactCastTo((Class<T>)self.getClass()))
//         .then(onSuccess(o -> equalityChecker.test(self, o)))
//         .then(ifFailed(__ -> false))
//         .resolve();
// }


// Path: src/test/java/examples/ConciseEquals.java
import java.util.Objects;
import static co.unruly.control.casts.Equality.areEqual;

package examples;



/**
 * Just a demonstration of how we can build a cleaner way to check equality
 * using Result-based casts under the hood.
 */
public class ConciseEquals {

    private final int number;
    private final String text;

    public ConciseEquals(int number, String text) {
        this.number = number;
        this.text = text;
    }

//    The best of the IntelliJ inbuilt equality templates
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        ConciseEquals that = (ConciseEquals) o;
//        return number == that.number &&
//            Objects.equals(text, that.text);
//    }

    @Override
    public boolean equals(Object o) {
        return areEqual(this, o, (a, b) ->