Package com.github.tonivade.purefun.core
Class Equal<T>
java.lang.Object
com.github.tonivade.purefun.core.Equal<T>
- Type Parameters:
T- type to which it applies
This is a utility class to generate more readable
equals() methods. It's based on Eq instances and it can combine
some of them to generate a bigger function that verify the equivalence between two instances of the same type T.
@Override
public boolean equals(Object obj) {
return<Equal.Data>of()
.comparing(Data::getId)
.comparing(Data::getValue)
.applyTo(this, obj);
}-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate booleancomparingArray(Function1<T, V[]> getter) static <T> Equal<T> of()private booleansameClasses(T self, Object obj) private booleansameObjects(T self, Object obj)
-
Field Details
-
tester
-
-
Constructor Details
-
Equal
-
-
Method Details
-
append
-
comparing
-
comparingArray
-
applyTo
-
areEquals
-
sameClasses
-
sameObjects
-
of
-