Package fj
Class Equal<A>
java.lang.Object
fj.Equal<A>
Tests for equality between two objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Primitives functions of Equal: alternative minimal definition and overridable methods.static interface
Primitives functions of Equal: minimal definition and overridable methods. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Equal
<BigDecimal> An equal instance for theBigDecimal
type.static final Equal
<BigInteger> An equal instance for theBigInteger
type.An equal instance for theBitSet
type.An equal instance for theboolean
type.An equal instance for thebyte
type.An equal instance for thechar
type.private final Equal.Definition
<A> An equal instance for thedouble
type.static final Equal
<LazyString> An equal instance for lazy strings.An equal instance for thefloat
type.static final Equal
<HList.HNil> An equal instance for the empty heterogeneous list.An equal instance for theint
type.An equal instance for thelong
type.An equal instance for theNatural
type.An equal instance for theshort
type.static final Equal
<StringBuffer> An equal instance for theStringBuffer
type.static final Equal
<StringBuilder> An equal instance for theStringBuilder
type.An equal instance for theString
type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Equal
<A> anyEqual()
Returns an equal instance that uses theObject.equals(Object)
method to test for equality.arrayEqual
(Equal<A> ea) An equal instance for theArray
type.static <A,
B> Equal <A> Static version ofcontramap(F)
<B> Equal
<B> Maps the given function across this equal as a contra-variant functor.private static <A,
B> Equal.Definition <B> contramapDef
(F<B, A> f, Equal.Definition<A> aEqDef) either3Equal
(Equal<A> ea, Equal<B> eb, Equal<C> ec) eitherEqual
(Equal<A> ea, Equal<B> eb) An equal instance for theEither
type.eq()
First-class equality check.Partially applied equality check.boolean
Returnstrue
if the two given arguments are equal,false
otherwise.static <A> Equal
<A> Constructs an equal instance from the given function.static <A> Equal
<A> Constructs an equal instance from the given function.static <A> Equal
<A> equalDef
(Equal.AltDefinition<A> definition) Constructs an equal instance from the given (alternative) definition.static <A> Equal
<A> equalDef
(Equal.Definition<A> definition) Constructs an equal instance from the given definition.static <A> boolean
Helper method to implementObject.equals(Object)
correctly.static <A> boolean
Helper method to implementObject.equals(Object)
correctly.static <E,
L extends HList<L>>
Equal<HList.HCons<E, L>> hListEqual
(Equal<E> e, Equal<L> l) An equal instance for heterogeneous lists.An equal instance for theList
type.static <A> Equal
<NonEmptyList<A>> nonEmptyListEqual
(Equal<A> ea) An equal instance for theNonEmptyList
type.not()
An equal instance, which reverts equality for selfboolean
Returnstrue
if the two given arguments are not equal,false
otherwise.static <A,
B> Equal.Definition <A> Begin definition of an equal instance.optionEqual
(Equal<A> ea) An equal instance for theOption
type.An equal instance for a product-1.An equal instance for a product-2.An equal instance for a product-3.An equal instance for a product-4.An equal instance for a product-5.An equal instance for a product-6.An equal instance for a product-7.p8Equal
(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef, Equal<G> eg, Equal<H> eh) An equal instance for a product-8.resultEqual
(Equal<A> ea, Equal<I> ei) Equal instance for sets.streamEqual
(Equal<A> ea) An equal instance for theStream
type.An equal instance for theTree
type.treeMapEqual
(Equal<K> k, Equal<V> v) static <A> Equal
<TreeZipper<A>> treeZipperEqual
(Equal<A> ea) An equal instance for theTreeZipper
type.An equal instance for a vector-2.An equal instance for a vector-3.An equal instance for a vector-4.An equal instance for a vector-5.An equal instance for a vector-6.An equal instance for a vector-7.An equal instance for a vector-8.static <A,
B> Equal <Validation<A, B>> validationEqual
(Equal<A> ea, Equal<B> eb) An equal instance for theValidation
type.writerEqual
(Equal<A> eq1, Equal<B> eq2) zipperEqual
(Equal<A> ea) An equal instance for theZipper
type.
-
Field Details
-
def
-
booleanEqual
An equal instance for theboolean
type. -
byteEqual
An equal instance for thebyte
type. -
charEqual
An equal instance for thechar
type. -
doubleEqual
An equal instance for thedouble
type. -
floatEqual
An equal instance for thefloat
type. -
intEqual
An equal instance for theint
type. -
bigintEqual
An equal instance for theBigInteger
type. -
bigdecimalEqual
An equal instance for theBigDecimal
type. -
longEqual
An equal instance for thelong
type. -
shortEqual
An equal instance for theshort
type. -
naturalEqual
An equal instance for theNatural
type. -
stringEqual
An equal instance for theString
type. -
stringBufferEqual
An equal instance for theStringBuffer
type. -
stringBuilderEqual
An equal instance for theStringBuilder
type. -
bitSetSequal
An equal instance for theBitSet
type. -
eq
An equal instance for lazy strings. -
hListEqual
An equal instance for the empty heterogeneous list.
-
-
Constructor Details
-
Equal
-
-
Method Details
-
eq
Returnstrue
if the two given arguments are equal,false
otherwise.- Parameters:
a1
- An object to test for equality against another.a2
- An object to test for equality against another.- Returns:
true
if the two given arguments are equal,false
otherwise.
-
notEq
Returnstrue
if the two given arguments are not equal,false
otherwise.- Parameters:
a1
- An object to test for inequality against another.a2
- An object to test for inequality against another.- Returns:
true
if the two given arguments are not equal,false
otherwise.
-
eq
First-class equality check.- Returns:
- A function that returns
true
if the two given arguments are equal.
-
eq
Partially applied equality check.- Parameters:
a
- An object to test for equality against another.- Returns:
- A function that returns
true
if the given argument equals the argument to this method.
-
contramap
Maps the given function across this equal as a contra-variant functor.- Parameters:
f
- The function to map.- Returns:
- A new equal.
-
not
An equal instance, which reverts equality for self- Returns:
- A new equal instance
-
contramapDef
-
contramap
Static version ofcontramap(F)
-
on
Begin definition of an equal instance.- See Also:
-
equal
Constructs an equal instance from the given function. Java 8+ users: useequalDef(Definition)
instead.- Parameters:
f
- The function to construct the equal with.- Returns:
- An equal instance from the given function.
-
equal
Constructs an equal instance from the given function. Java 8+ users: useequalDef(AltDefinition)
instead.- Parameters:
f
- The function to construct the equal with.- Returns:
- An equal instance from the given function.
-
equalDef
Constructs an equal instance from the given definition.- Parameters:
definition
- a definition of the equal instance.- Returns:
- An equal instance from the given function.
-
equalDef
Constructs an equal instance from the given (alternative) definition.- Parameters:
definition
- a definition of the equal instance.- Returns:
- An equal instance from the given function.
-
anyEqual
Returns an equal instance that uses theObject.equals(Object)
method to test for equality.- Returns:
- An equal instance that uses the
Object.equals(Object)
method to test for equality.
-
eitherEqual
An equal instance for theEither
type. -
either3Equal
-
resultEqual
-
validationEqual
An equal instance for theValidation
type.- Parameters:
ea
- Equality across the failing side ofValidation
.eb
- Equality across the succeeding side ofValidation
.- Returns:
- An equal instance for the
Validation
type.
-
listEqual
An equal instance for theList
type.- Parameters:
ea
- Equality across the elements of the list.- Returns:
- An equal instance for the
List
type.
-
nonEmptyListEqual
An equal instance for theNonEmptyList
type.- Parameters:
ea
- Equality across the elements of the non-empty list.- Returns:
- An equal instance for the
NonEmptyList
type.
-
optionEqual
An equal instance for theOption
type.- Parameters:
ea
- Equality across the element of the option.- Returns:
- An equal instance for the
Option
type.
-
seqEqual
-
streamEqual
An equal instance for theStream
type.- Parameters:
ea
- Equality across the elements of the stream.- Returns:
- An equal instance for the
Stream
type.
-
zipperEqual
An equal instance for theZipper
type.- Parameters:
ea
- Equality across the elements of the zipper.- Returns:
- An equal instance for the
Zipper
type.
-
treeZipperEqual
An equal instance for theTreeZipper
type.- Parameters:
ea
- Equality across the elements of the tree zipper.- Returns:
- An equal instance for the
TreeZipper
type.
-
arrayEqual
An equal instance for theArray
type.- Parameters:
ea
- Equality across the elements of the array.- Returns:
- An equal instance for the
Array
type.
-
treeEqual
An equal instance for theTree
type.- Parameters:
ea
- Equality across the elements of the tree.- Returns:
- An equal instance for the
Tree
type.
-
p1Equal
An equal instance for a product-1.- Parameters:
ea
- Equality across the first element of the product.- Returns:
- An equal instance for a product-1.
-
p2Equal
An equal instance for a product-2.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.- Returns:
- An equal instance for a product-2.
-
p3Equal
An equal instance for a product-3.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.- Returns:
- An equal instance for a product-3.
-
p4Equal
public static <A,B, Equal<P4<A,C, D> B, p4EqualC, D>> (Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed) An equal instance for a product-4.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.ed
- Equality across the fourth element of the product.- Returns:
- An equal instance for a product-4.
-
p5Equal
public static <A,B, Equal<P5<A,C, D, E> B, p5EqualC, D, E>> (Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee) An equal instance for a product-5.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.ed
- Equality across the fourth element of the product.ee
- Equality across the fifth element of the product.- Returns:
- An equal instance for a product-5.
-
p6Equal
public static <A,B, Equal<P6<A,C, D, E, F$> B, p6EqualC, D, E, F$>> (Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef) An equal instance for a product-6.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.ed
- Equality across the fourth element of the product.ee
- Equality across the fifth element of the product.ef
- Equality across the sixth element of the product.- Returns:
- An equal instance for a product-6.
-
p7Equal
public static <A,B, Equal<P7<A,C, D, E, F$, G> B, p7EqualC, D, E, F$, G>> (Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef, Equal<G> eg) An equal instance for a product-7.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.ed
- Equality across the fourth element of the product.ee
- Equality across the fifth element of the product.ef
- Equality across the sixth element of the product.eg
- Equality across the seventh element of the product.- Returns:
- An equal instance for a product-7.
-
p8Equal
public static <A,B, Equal<P8<A,C, D, E, F$, G, H> B, p8EqualC, D, E, F$, G, H>> (Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef, Equal<G> eg, Equal<H> eh) An equal instance for a product-8.- Parameters:
ea
- Equality across the first element of the product.eb
- Equality across the second element of the product.ec
- Equality across the third element of the product.ed
- Equality across the fourth element of the product.ee
- Equality across the fifth element of the product.ef
- Equality across the sixth element of the product.eg
- Equality across the seventh element of the product.eh
- Equality across the eighth element of the product.- Returns:
- An equal instance for a product-8.
-
v2Equal
An equal instance for a vector-2.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-2.
-
v3Equal
An equal instance for a vector-3.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-3.
-
v4Equal
An equal instance for a vector-4.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-4.
-
v5Equal
An equal instance for a vector-5.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-5.
-
v6Equal
An equal instance for a vector-6.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-6.
-
v7Equal
An equal instance for a vector-7.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-7.
-
v8Equal
An equal instance for a vector-8.- Parameters:
ea
- Equality across the elements of the vector.- Returns:
- An equal instance for a vector-8.
-
hListEqual
An equal instance for heterogeneous lists.- Parameters:
e
- Equality for the first element of the list.l
- Equality for the rest of the list.- Returns:
- an equal instance for a heterogeneous list.
-
setEqual
Equal instance for sets.- Parameters:
e
- Equality for the set elements.- Returns:
- An equal instance for sets.
-
treeMapEqual
-
writerEqual
-
equals0
Helper method to implementObject.equals(Object)
correctly. DO NOT USE it for any other purpose.- Parameters:
clazz
- the class in which theObject.equals(Object)
is implementedself
- a reference to 'this'other
- the other object of the comparisonequal
- an equal instance for the type of self (that useanyEqual()
if generic type).- Returns:
- true if self and other are equal
-
equals0
Helper method to implementObject.equals(Object)
correctly. DO NOT USE it for any other purpose.- Parameters:
clazz
- the class in which theObject.equals(Object)
is implementedself
- a reference to 'this'other
- the other object of the comparisonequal
- a lazy equal instance for the type (that useanyEqual()
if generic type)..- Returns:
- true if self and other are equal
-