Package fj
Class Ord<A>
java.lang.Object
fj.Ord<A>
Tests for ordering between two objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePrimitives functions of Ord: alternative minimal definition and overridable methods.static interfacePrimitives functions of Ord: minimal definition and overridable methods.(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Ord<BigDecimal> An order instance for theBigDecimaltype.static final Ord<BigInteger> An order instance for theBigIntegertype.An order instance for thebooleantype.An order instance for thebytetype.An order instance for thechartype.private final Ord.Definition<A> An order instance for thedoubletype.An order instance for thefloattype.An order instance for theinttype.An order instance for thelongtype.A function that returns the greater of its two arguments.A function that returns the lesser of its two arguments.An order instance for theNaturaltype.An order instance for theOrderingtype.An order instance for theshorttype.static final Ord<StringBuffer> An order instance for theStringBuffertype.static final Ord<StringBuilder> An order instance for theStringBuffertype.An order instance for theStringtype.An order instance for theUnittype. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAn order instance for theArraytype.static <A extends Comparable<A>>
Ord<A> An order instance for theComparableinterface.compare()First-class ordering.Returns an ordering for the given arguments.static <A,B> Ord <A> Static version ofcontramap(F)<B> Ord<B> Maps the given function across this ord as a contra-variant functor.private static <A,B> Ord.Definition <B> contramapDef(F<B, A> f, Ord.Definition<A> def) An order instance for theEithertype.booleanReturnstrueif the given arguments are equal,falseotherwise.equal()Returns anEqualfor this order.isGreaterThan(A a) Returns a function that returns true if its argument is greater than than the argument to this method.booleanisGreaterThan(A a1, A a2) Returnstrueif the first given argument is greater than the second given argument,falseotherwise.isLessThan(A a) Returns a function that returns true if its argument is less than the argument to this method.booleanisLessThan(A a1, A a2) Returnstrueif the first given argument is less than the second given argument,falseotherwise.booleanisLessThanOrEqualTo(A a1, A a2) Returnstrueif the first given argument is less than or equal to the second given argument,falseotherwise.An order instance for theListtype.Returns the greater of its two arguments.Returns the lesser of its two arguments.static <A> Ord<NonEmptyList<A>> nonEmptyListOrd(Ord<A> oa) An order instance for theNonEmptyListtype.static <A,B> Ord.Definition <A> Begin definition of an ord instance.An order instance for theOptiontype.static <A> Ord<A> Returns an order instance that uses the given equality test and ordering function.static <A> Ord<A> Returns an order instance that uses the given equality test and ordering function.static <A> Ord<A> ordDef(Ord.AltDefinition<A> def) Returns an order instance that uses the given minimal equality test and ordering definition.static <A> Ord<A> ordDef(Ord.Definition<A> def) Returns an order instance that uses the given minimal equality test and ordering definition.An order instance for a product-1.An order instance for a product-2, with the first factor considered most significant.An order instance for a product-3, with the first factor considered most significant.reverse()Return a seq ord using the given value ord.An order instance for theSettype.An order instance for theStreamtype.static <A,B> Ord <Validation<A, B>> validationOrd(Ord<A> oa, Ord<B> ob) An order instance for theValidationtype.
-
Field Details
-
def
-
max
A function that returns the greater of its two arguments. -
min
A function that returns the lesser of its two arguments. -
booleanOrd
An order instance for thebooleantype. -
byteOrd
An order instance for thebytetype. -
charOrd
An order instance for thechartype. -
doubleOrd
An order instance for thedoubletype. -
floatOrd
An order instance for thefloattype. -
intOrd
An order instance for theinttype. -
bigintOrd
An order instance for theBigIntegertype. -
bigdecimalOrd
An order instance for theBigDecimaltype. -
longOrd
An order instance for thelongtype. -
shortOrd
An order instance for theshorttype. -
orderingOrd
An order instance for theOrderingtype. -
stringOrd
An order instance for theStringtype. -
stringBufferOrd
An order instance for theStringBuffertype. -
stringBuilderOrd
An order instance for theStringBuffertype. -
unitOrd
An order instance for theUnittype. -
naturalOrd
An order instance for theNaturaltype.
-
-
Constructor Details
-
Ord
-
-
Method Details
-
compare
First-class ordering.- Returns:
- A function that returns an ordering for its arguments.
-
compare
Returns an ordering for the given arguments.- Parameters:
a1- An instance to compare for ordering to another.a2- An instance to compare for ordering to another.- Returns:
- An ordering for the given arguments.
-
eq
Returnstrueif the given arguments are equal,falseotherwise.- Parameters:
a1- An instance to compare for equality to another.a2- An instance to compare for equality to another.- Returns:
trueif the given arguments are equal,falseotherwise.
-
equal
Returns anEqualfor this order.- Returns:
- An
Equalfor this order.
-
contramap
Maps the given function across this ord as a contra-variant functor.- Parameters:
f- The function to map.- Returns:
- A new ord.
-
isLessThan
Returnstrueif the first given argument is less than the second given argument,falseotherwise.- Parameters:
a1- An instance to compare for ordering to another.a2- An instance to compare for ordering to another.- Returns:
trueif the first given argument is less than the second given argument,falseotherwise.
-
isLessThanOrEqualTo
Returnstrueif the first given argument is less than or equal to the second given argument,falseotherwise.- Parameters:
a1- An instance to compare for ordering to another.a2- An instance to compare for ordering to another.- Returns:
trueif the first given argument is less than or equal to the second given argument,falseotherwise.
-
isGreaterThan
Returnstrueif the first given argument is greater than the second given argument,falseotherwise.- Parameters:
a1- An instance to compare for ordering to another.a2- An instance to compare for ordering to another.- Returns:
trueif the first given argument is greater than the second given argument,falseotherwise.
-
isLessThan
Returns a function that returns true if its argument is less than the argument to this method.- Parameters:
a- A value to compare against.- Returns:
- A function that returns true if its argument is less than the argument to this method.
-
isGreaterThan
Returns a function that returns true if its argument is greater than than the argument to this method.- Parameters:
a- A value to compare against.- Returns:
- A function that returns true if its argument is greater than the argument to this method.
-
max
Returns the greater of its two arguments.- Parameters:
a1- A value to compare with another.a2- A value to compare with another.- Returns:
- The greater of the two values.
-
min
Returns the lesser of its two arguments.- Parameters:
a1- A value to compare with another.a2- A value to compare with another.- Returns:
- The lesser of the two values.
-
minSemigroup
-
minMonoid
-
maxSemigroup
-
maxMonoid
-
reverse
-
on
Begin definition of an ord instance.- See Also:
-
contramap
Static version ofcontramap(F) -
contramapDef
-
ord
Returns an order instance that uses the given equality test and ordering function. Java 8+ users: useordDef(Definition)instead.- Parameters:
f- The order function.- Returns:
- An order instance.
-
ord
Returns an order instance that uses the given equality test and ordering function. Java 8+ users: useordDef(AltDefinition)instead.- Parameters:
f- The order function.- Returns:
- An order instance.
-
ordDef
Returns an order instance that uses the given minimal equality test and ordering definition.- Parameters:
def- The order definition.- Returns:
- An order instance.
-
ordDef
Returns an order instance that uses the given minimal equality test and ordering definition.- Parameters:
def- The order definition.- Returns:
- An order instance.
-
optionOrd
An order instance for theOptiontype.- Parameters:
oa- Order across the element of the option.- Returns:
- An order instance for the
Optiontype.
-
eitherOrd
An order instance for theEithertype. -
validationOrd
An order instance for theValidationtype.- Parameters:
oa- Order across the failing side ofValidation.ob- Order across the succeeding side ofValidation.- Returns:
- An order instance for the
Validationtype.
-
listOrd
An order instance for theListtype.- Parameters:
oa- Order across the elements of the list.- Returns:
- An order instance for the
Listtype.
-
seqOrd
Return a seq ord using the given value ord.- Type Parameters:
A- the type of the seq value- Parameters:
ord- the given value ord- Returns:
- the seq ord
-
nonEmptyListOrd
An order instance for theNonEmptyListtype.- Parameters:
oa- Order across the elements of the non-empty list.- Returns:
- An order instance for the
NonEmptyListtype.
-
streamOrd
An order instance for theStreamtype.- Parameters:
oa- Order across the elements of the stream.- Returns:
- An order instance for the
Streamtype.
-
arrayOrd
An order instance for theArraytype.- Parameters:
oa- Order across the elements of the array.- Returns:
- An order instance for the
Arraytype.
-
setOrd
An order instance for theSettype.- Parameters:
oa- Order across the elements of the set.- Returns:
- An order instance for the
Settype.
-
p1Ord
An order instance for a product-1.- Parameters:
oa- Order across the produced type.- Returns:
- An order instance for a product-1.
-
p2Ord
An order instance for a product-2, with the first factor considered most significant.- Parameters:
oa- An order instance for the first factor.ob- An order instance for the second factor.- Returns:
- An order instance for a product-2, with the first factor considered most significant.
-
p2Ord1
-
p2Ord2
-
p3Ord
An order instance for a product-3, with the first factor considered most significant.- Parameters:
oa- An order instance for the first factor.ob- An order instance for the second factor.oc- An order instance for the third factor.- Returns:
- An order instance for a product-3, with the first factor considered most significant.
-
comparableOrd
An order instance for theComparableinterface.- Returns:
- An order instance for the
Comparableinterface.
-
toComparator
-