Package fj
Class Ord<A>
java.lang.Object
fj.Ord<A>
Tests for ordering between two objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Primitives functions of Ord: alternative minimal definition and overridable methods.static interface
Primitives functions of Ord: minimal definition and overridable methods.(package private) class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Ord
<BigDecimal> An order instance for theBigDecimal
type.static final Ord
<BigInteger> An order instance for theBigInteger
type.An order instance for theboolean
type.An order instance for thebyte
type.An order instance for thechar
type.private final Ord.Definition
<A> An order instance for thedouble
type.An order instance for thefloat
type.An order instance for theint
type.An order instance for thelong
type.A function that returns the greater of its two arguments.A function that returns the lesser of its two arguments.An order instance for theNatural
type.An order instance for theOrdering
type.An order instance for theshort
type.static final Ord
<StringBuffer> An order instance for theStringBuffer
type.static final Ord
<StringBuilder> An order instance for theStringBuffer
type.An order instance for theString
type.An order instance for theUnit
type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAn order instance for theArray
type.static <A extends Comparable<A>>
Ord<A> An order instance for theComparable
interface.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 theEither
type.boolean
Returnstrue
if the given arguments are equal,false
otherwise.equal()
Returns anEqual
for this order.isGreaterThan
(A a) Returns a function that returns true if its argument is greater than than the argument to this method.boolean
isGreaterThan
(A a1, A a2) Returnstrue
if the first given argument is greater than the second given argument,false
otherwise.isLessThan
(A a) Returns a function that returns true if its argument is less than the argument to this method.boolean
isLessThan
(A a1, A a2) Returnstrue
if the first given argument is less than the second given argument,false
otherwise.boolean
isLessThanOrEqualTo
(A a1, A a2) Returnstrue
if the first given argument is less than or equal to the second given argument,false
otherwise.An order instance for theList
type.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 theNonEmptyList
type.static <A,
B> Ord.Definition <A> Begin definition of an ord instance.An order instance for theOption
type.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 theSet
type.An order instance for theStream
type.static <A,
B> Ord <Validation<A, B>> validationOrd
(Ord<A> oa, Ord<B> ob) An order instance for theValidation
type.
-
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 theboolean
type. -
byteOrd
An order instance for thebyte
type. -
charOrd
An order instance for thechar
type. -
doubleOrd
An order instance for thedouble
type. -
floatOrd
An order instance for thefloat
type. -
intOrd
An order instance for theint
type. -
bigintOrd
An order instance for theBigInteger
type. -
bigdecimalOrd
An order instance for theBigDecimal
type. -
longOrd
An order instance for thelong
type. -
shortOrd
An order instance for theshort
type. -
orderingOrd
An order instance for theOrdering
type. -
stringOrd
An order instance for theString
type. -
stringBufferOrd
An order instance for theStringBuffer
type. -
stringBuilderOrd
An order instance for theStringBuffer
type. -
unitOrd
An order instance for theUnit
type. -
naturalOrd
An order instance for theNatural
type.
-
-
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
Returnstrue
if the given arguments are equal,false
otherwise.- Parameters:
a1
- An instance to compare for equality to another.a2
- An instance to compare for equality to another.- Returns:
true
if the given arguments are equal,false
otherwise.
-
equal
Returns anEqual
for this order.- Returns:
- An
Equal
for 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
Returnstrue
if the first given argument is less than the second given argument,false
otherwise.- Parameters:
a1
- An instance to compare for ordering to another.a2
- An instance to compare for ordering to another.- Returns:
true
if the first given argument is less than the second given argument,false
otherwise.
-
isLessThanOrEqualTo
Returnstrue
if the first given argument is less than or equal to the second given argument,false
otherwise.- Parameters:
a1
- An instance to compare for ordering to another.a2
- An instance to compare for ordering to another.- Returns:
true
if the first given argument is less than or equal to the second given argument,false
otherwise.
-
isGreaterThan
Returnstrue
if the first given argument is greater than the second given argument,false
otherwise.- Parameters:
a1
- An instance to compare for ordering to another.a2
- An instance to compare for ordering to another.- Returns:
true
if the first given argument is greater than the second given argument,false
otherwise.
-
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 theOption
type.- Parameters:
oa
- Order across the element of the option.- Returns:
- An order instance for the
Option
type.
-
eitherOrd
An order instance for theEither
type. -
validationOrd
An order instance for theValidation
type.- Parameters:
oa
- Order across the failing side ofValidation
.ob
- Order across the succeeding side ofValidation
.- Returns:
- An order instance for the
Validation
type.
-
listOrd
An order instance for theList
type.- Parameters:
oa
- Order across the elements of the list.- Returns:
- An order instance for the
List
type.
-
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 theNonEmptyList
type.- Parameters:
oa
- Order across the elements of the non-empty list.- Returns:
- An order instance for the
NonEmptyList
type.
-
streamOrd
An order instance for theStream
type.- Parameters:
oa
- Order across the elements of the stream.- Returns:
- An order instance for the
Stream
type.
-
arrayOrd
An order instance for theArray
type.- Parameters:
oa
- Order across the elements of the array.- Returns:
- An order instance for the
Array
type.
-
setOrd
An order instance for theSet
type.- Parameters:
oa
- Order across the elements of the set.- Returns:
- An order instance for the
Set
type.
-
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 theComparable
interface.- Returns:
- An order instance for the
Comparable
interface.
-
toComparator
-