Class Semigroups
java.lang.Object
io.atlassian.fugue.Semigroups
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Semigroup<BigDecimal> A semigroup that yields the maximum of big decimals.static final Semigroup<BigDecimal> A semigroup that yields the minimum of big decimals.static final Semigroup<BigInteger> A semigroup that yields the maximum of big integers.static final Semigroup<BigInteger> A semigroup that yields the minimum of big integers.A semigroup that yields the maximum of integers.A semigroup that yields the minimum of integers.A semigroup that yields the maximum of longs.A semigroup that yields the minimum of longs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSums up values inside either, if both are left or right.static <A> Semigroup<A> first()Return the first value, ignore the secondA semigroup for functions.static <A> Semigroup<A> last()Return the last value, ignore the firststatic <A extends Comparable<A>>
Semigroup<A> max()A semigroup that yields the maximum of comparable values.static <A> Semigroup<A> max(Comparator<A> comparator) A semigroup that yields the maximum of by a comparator.static <A extends Comparable<A>>
Semigroup<A> min()A semigroup that yields the minimum of comparable values.static <A> Semigroup<A> min(Comparator<A> comparator) A semigroup that yields the minimum of by a comparator.
-
Field Details
-
intMaximum
-
intMinimum
-
bigintMaximum
A semigroup that yields the maximum of big integers. -
bigintMinimum
A semigroup that yields the minimum of big integers. -
bigDecimalMaximum
A semigroup that yields the maximum of big decimals. -
bigDecimalMinimum
A semigroup that yields the minimum of big decimals. -
longMaximum
-
longMinimum
-
-
Constructor Details
-
Semigroups
private Semigroups()
-
-
Method Details
-
first
-
last
-
function
-
max
A semigroup that yields the maximum of by a comparator.- Type Parameters:
A- result type- Parameters:
comparator- the comparator used to define the max of two value.- Returns:
- A max semigroup.
-
min
A semigroup that yields the minimum of by a comparator.- Type Parameters:
A- result type- Parameters:
comparator- the comparator used to define the min of two value.- Returns:
- A min semigroup.
-
max
A semigroup that yields the maximum of comparable values.- Type Parameters:
A- result type- Returns:
- A max semigroup.
-
min
A semigroup that yields the minimum of comparable values.- Type Parameters:
A- result type- Returns:
- A min semigroup.
-
either
Sums up values inside either, if both are left or right. Returns first left otherwise.- right(v1) + right(v2) → right(v1 + v2)
- right(v1) + -left(v2) → left(v2)
- left(v1) + right(v2) → left(v1)
- left(v1) + left(v2) → left(v1 + v2)
- Type Parameters:
L- left typeR- right type- Parameters:
lS- Semigroup for left valuesrS- Semigroup for right values- Returns:
- A semigroup that Sums up values inside either.
-