/** * An equal instance for the {@link NonEmptyList} type. * * @param ea Equality across the elements of the non-empty list. * @return An equal instance for the {@link NonEmptyList} type. */ public static <A> Equal<NonEmptyList<A>> nonEmptyListEqual(final Equal<A> ea) { return listEqual(ea).contramap(NonEmptyList.toList_()); }
/** * 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())); }