/** * Compare two key values for equality using the underlying equality strategy. * * @param k1 One key value to compare. * @param k2 The other key value to compare. * @return <code>true</code> if the two key values are equal, <code>false</code> otherwise. */ public boolean eq(final K k1, final K k2) { return e.eq(k1, k2); }
/** * Constructs an equal instance from the given definition. * * @param definition a definition of the equal instance. * @return An equal instance from the given function. */ public static <A> Equal<A> equalDef(final Definition<A> definition) { return new Equal<>(definition); }
/** * An equal instance for the {@link TreeZipper} type. * * @param ea Equality across the elements of the tree zipper. * @return An equal instance for the {@link TreeZipper} type. */ public static <A> Equal<TreeZipper<A>> treeZipperEqual(final Equal<A> ea) { final Equal<Tree<A>> te = Equal.treeEqual(ea); final Equal<Stream<Tree<A>>> st = streamEqual(Equal.treeEqual(ea)); final Equal<Stream<P3<Stream<Tree<A>>, A, Stream<Tree<A>>>>> sp = streamEqual(p3Equal(streamEqual(treeEqual(ea)), ea, streamEqual(treeEqual(ea)))); return equalDef((a1, a2) -> te.eq(a1.focus(), a2.focus()) && st.eq(a1.lefts(), a2.lefts()) && st.eq(a1.rights(), a2.rights()) && sp.eq(a1.parents(), a2.parents()) ); }
@Override public final boolean equals(Object other) { return Equal.equals0(Result.class, this, other, () -> Equal.resultEqual(Equal.anyEqual(), Equal.anyEqual())); }
/** * Perform an equality test on this list which delegates to the .equals() method of the member instances. * This is implemented with Equal.nonEmptyListEqual using the anyEqual rule. * * @param obj the other object to check for equality against. * @return true if this list is equal to the provided argument */ @Override public boolean equals( final Object obj ) { return Equal.equals0(NonEmptyList.class, this, obj, () -> Equal.nonEmptyListEqual(Equal.anyEqual())); }
/** * Perform an equality test on this list which delegates to the .equals() method of the member instances. * This is implemented with Equal.listEqual using the anyEqual rule. * * @param obj the other object to check for equality against. * @return true if this list is equal to the provided argument */ @Override public final boolean equals(final Object obj) { return Equal.equals0(List.class, this, obj, () -> Equal.listEqual(Equal.anyEqual())); }
@Override public final boolean equals(Object other) { return Equal.equals0(Zipper.class, this, other, () -> Equal.zipperEqual(Equal.anyEqual())); }
@Override public final boolean equals(Object other) { return Equal.equals0(Validation.class, this, other, () -> Equal.validationEqual(Equal.anyEqual(), Equal.anyEqual())); }
@Override public final boolean equals(Object other) { return Equal.equals0(Either.class, this, other, () -> Equal.eitherEqual(Equal.anyEqual(), Equal.anyEqual())); }
@Override public boolean equals(Object o) { return Equal.equals0(Array.class, this, o, () -> Equal.arrayEqual(Equal.anyEqual())); }