public interface Monoids
Modifier and Type | Field and Description |
---|---|
static Monoid<java.math.BigInteger> |
bigIntCount
Combine two BigIntegers by adding one to a (can be used to count BigIntegers in a Collection or Stream)
|
static Monoid<java.math.BigInteger> |
bigIntMax
Combine two BigIntegers by selecting the max
|
static Monoid<java.math.BigInteger> |
bigIntMin
Combine two BigIntegers by selecting the min
|
static Monoid<java.math.BigInteger> |
bigIntMult
Combine two BigIntegers by multiplying them
|
static Monoid<java.math.BigInteger> |
bigIntSum
Combine two BigIngegers by summing them
|
static Monoid<java.lang.Boolean> |
booleanConjunction
Combine two booleans by AND'ing them (conjunction)
|
static Monoid<java.lang.Boolean> |
booleanDisjunction
Combine two booleans by OR'ing them (disjunction)
|
static Monoid<java.lang.Boolean> |
booleanXDisjunction
Combine two booleans by XOR'ing them (exclusive disjunction)
|
static Monoid<java.lang.Double> |
doubleCount
Combine two Double by adding one to a (can be used to count Double in a Collection or Stream)
|
static Monoid<java.lang.Double> |
doubleMax
Combine two Doubles by selecting the max
|
static Monoid<java.lang.Double> |
doubleMin
Combine two Doubles by selecting the min
|
static Monoid<java.lang.Double> |
doubleMult
Combine two Doubles by multiplying them
|
static Monoid<java.lang.Double> |
doubleSum
Combine two Doubles by summing them
|
static Monoid<java.lang.Integer> |
intCount
Combine two Integers by adding one to a (can be used to count Integers in a Collection or Stream)
|
static Monoid<java.lang.Integer> |
intMax
Combine two Integers by selecting the max
|
static Monoid<java.lang.Integer> |
intMin
Combine two Integers by selecting the min
|
static Monoid<java.lang.Integer> |
intMult
Combine two Integers by multiplying them
|
static Monoid<java.lang.Integer> |
intSum
Combine two Integers by summing them
|
static Monoid<java.lang.Long> |
longCount
Combine two Longs by adding one to a (can be used to count Integers in a Collection or Stream)
|
static Monoid<java.lang.Long> |
longMax
Combine two Longs by selecting the max
|
static Monoid<java.lang.Long> |
longMin
Combine two Longs by selecting the min
|
static Monoid<java.lang.Long> |
longMult
Combine two Longs by multiplying them
|
static Monoid<java.lang.Long> |
longSum
Combine two Longs by summing them
|
static Monoid<java.lang.StringBuffer> |
stringBufferConcat
StringBuffer concatenation
|
static Monoid<java.lang.StringBuilder> |
stringBuilderConcat
StringBuilder concatenation
|
static Monoid<java.lang.String> |
stringConcat
String concatenation
|
Modifier and Type | Method and Description |
---|---|
static <T,C extends java.util.Collection<T>> |
collectionConcat(C zero)
This Semigroup will attempt to combine JDK Collections.
|
static <T,C extends FluentCollectionX<T>> |
collectionXConcat(C identity)
To manage javac type inference first assign the monoid
|
static <T> Semigroup<LazyFutureStream<T>> |
combineFutureStream() |
static <T> Monoid<ReactiveSeq<T>> |
combineReactiveSeq() |
static <T,A extends Combiner<T>> |
combineScalarFunctors(java.util.function.Function<T,A> zeroFn,
Monoid<T> monoid)
Example sum integer Maybes
|
static <T> Monoid<org.jooq.lambda.Seq<T>> |
combineSeq() |
static <T> Monoid<java.util.stream.Stream<T>> |
combineStream() |
static <T,A extends Zippable<T>> |
combineZippables(java.util.function.Function<T,A> zeroFn,
Monoid<T> monoid)
Example sum integer Lists
|
static <T> Monoid<DequeX<T>> |
dequeXConcat() |
static <T> Monoid<java.util.concurrent.CompletableFuture<T>> |
firstCompleteCompletableFuture() |
static <T> Monoid<FutureW<T>> |
firstCompleteFuture() |
static <T,C extends java.util.Collection<T>> |
firstNonEmpty(C zero) |
static <T> Monoid<T> |
firstNonNull() |
static <T> Monoid<Maybe<T>> |
firstPresentMaybe() |
static <T> Monoid<java.util.Optional<T>> |
firstPresentOptional() |
static <ST,PT> Monoid<Ior<ST,PT>> |
firstPrimaryIor(ST zero) |
static <ST,PT> Monoid<Xor<ST,PT>> |
firstPrimaryXor(ST zero) |
static <ST,PT> Monoid<Ior<ST,PT>> |
firstSecondaryIor(PT zero) |
static <ST,PT> Monoid<Xor<ST,PT>> |
firstSecondaryXor(PT zero) |
static <T> Monoid<FutureW<T>> |
firstSuccessfulFuture() |
static <T,X extends java.lang.Throwable> |
firstTryFailure(T zero) |
static <T,X extends java.lang.Throwable> |
firstTrySuccess(X zero) |
static <A> Monoid<java.util.function.Function<A,A>> |
functionComposition() |
static <T,C extends java.util.Collection<T>> |
lastNonEmpty(C zero) |
static <T> Monoid<Maybe<T>> |
lastPresentMaybe() |
static <T> Monoid<java.util.Optional<T>> |
lastPresentOptional() |
static <ST,PT> Monoid<Ior<ST,PT>> |
lastPrimaryIor(ST zero) |
static <ST,PT> Monoid<Xor<ST,PT>> |
lastPrimaryXor(ST zero) |
static <ST,PT> Monoid<Ior<ST,PT>> |
lastSecondaryIor(PT zero) |
static <ST,PT> Monoid<Xor<ST,PT>> |
lastSecondaryXor(PT zero) |
static <T,X extends java.lang.Throwable> |
lastTryFailure(T zero) |
static <T,X extends java.lang.Throwable> |
lastTrySuccess(X zero) |
static <T> Monoid<ListX<T>> |
listXConcat() |
static <T,T2 extends java.lang.Comparable<T>> |
maxComparable(T2 min) |
static <T,T2 extends java.lang.Comparable<T>> |
minComparable(T2 max) |
static <T,C extends java.util.Collection<T>> |
mutableCollectionConcat(C identity)
Concatenate mutable collections
To manage javac type inference first assign the Monoid
|
static <T> Monoid<java.util.Deque<T>> |
mutableDequeConcat() |
static <T> Monoid<java.util.List<T>> |
mutableListConcat() |
static <T> Monoid<java.util.Queue<T>> |
mutableQueueConcat() |
static <T> Monoid<java.util.Set<T>> |
mutableSetConcat() |
static <T> Monoid<java.util.SortedSet<T>> |
mutableSortedSetConcat() |
static <T> Monoid<PBagX<T>> |
pBagXConcat() |
static <T> Monoid<POrderedSetX<T>> |
pOrderedSetXConcat() |
static <T> Monoid<PQueueX<T>> |
pQueueXConcat() |
static <T> Monoid<PSetX<T>> |
pSetXConcat() |
static <T> Monoid<PStackX<T>> |
pStackXConcat() |
static <T> Monoid<PVectorX<T>> |
pVectorXConcat() |
static <T> Monoid<QueueX<T>> |
queueXConcat() |
static <T> Monoid<SetX<T>> |
setXConcat() |
static <T> Monoid<SortedSetX<T>> |
sortedSetXConcat() |
static Monoid<java.lang.StringBuffer> |
stringBufferJoin(java.lang.String joiner) |
static Monoid<java.lang.StringBuilder> |
stringBuilderJoin(java.lang.String joiner) |
static Monoid<java.lang.String> |
stringJoin(java.lang.String joiner) |
static final Monoid<java.math.BigInteger> bigIntCount
static final Monoid<java.lang.Integer> intCount
static final Monoid<java.lang.Long> longCount
static final Monoid<java.lang.Double> doubleCount
static final Monoid<java.lang.Integer> intSum
static final Monoid<java.lang.Long> longSum
static final Monoid<java.lang.Double> doubleSum
static final Monoid<java.math.BigInteger> bigIntSum
static final Monoid<java.lang.Integer> intMult
static final Monoid<java.lang.Long> longMult
static final Monoid<java.lang.Double> doubleMult
static final Monoid<java.math.BigInteger> bigIntMult
static final Monoid<java.lang.Integer> intMax
static final Monoid<java.lang.Long> longMax
static final Monoid<java.lang.Double> doubleMax
static final Monoid<java.math.BigInteger> bigIntMax
static final Monoid<java.lang.Integer> intMin
static final Monoid<java.lang.Long> longMin
static final Monoid<java.lang.Double> doubleMin
static final Monoid<java.math.BigInteger> bigIntMin
static final Monoid<java.lang.String> stringConcat
static final Monoid<java.lang.StringBuffer> stringBufferConcat
static final Monoid<java.lang.StringBuilder> stringBuilderConcat
static final Monoid<java.lang.Boolean> booleanDisjunction
static final Monoid<java.lang.Boolean> booleanXDisjunction
static final Monoid<java.lang.Boolean> booleanConjunction
static <T,C extends FluentCollectionX<T>> Monoid<C> collectionXConcat(C identity)
Monoid<ListX<Integer>> listX = Monoid.of(identity,Semigroups.collectionXConcat(ListX.empty());
Monoid<SetX<Integer>> setX = Monoid.of(identity,Semigroups.collectionXConcat(SetX.empty());
static <T,C extends java.util.Collection<T>> Monoid<C> mutableCollectionConcat(C identity)
Monoid<List<Integer>> list = Monoid.of(identity,Semigroups.collectionConcat(Arrays.asList());
Monoid<Set<Integer>> set = Monoid.of(identity,Semigroups.collectionConcat(new HashSet());
static <T> Monoid<java.util.List<T>> mutableListConcat()
static <T> Monoid<java.util.Set<T>> mutableSetConcat()
static <T> Monoid<java.util.SortedSet<T>> mutableSortedSetConcat()
static <T> Monoid<java.util.Queue<T>> mutableQueueConcat()
static <T> Monoid<java.util.Deque<T>> mutableDequeConcat()
static <T> Monoid<ListX<T>> listXConcat()
static <T> Monoid<SetX<T>> setXConcat()
static <T> Monoid<SortedSetX<T>> sortedSetXConcat()
static <T> Monoid<QueueX<T>> queueXConcat()
static <T> Monoid<DequeX<T>> dequeXConcat()
static <T> Monoid<PStackX<T>> pStackXConcat()
static <T> Monoid<PVectorX<T>> pVectorXConcat()
static <T> Monoid<PSetX<T>> pSetXConcat()
static <T> Monoid<POrderedSetX<T>> pOrderedSetXConcat()
static <T> Monoid<PQueueX<T>> pQueueXConcat()
static <T> Monoid<PBagX<T>> pBagXConcat()
static <T,C extends java.util.Collection<T>> Monoid<C> collectionConcat(C zero)
Monoid<List<Integer>> list = Monoids.collectionConcat();
Monoid<Set<Integer>> set = Monoids.collectionConcat();
static <T,A extends Combiner<T>> Monoid<A> combineScalarFunctors(java.util.function.Function<T,A> zeroFn, Monoid<T> monoid)
Monoid<Maybe<Integer>> sumMaybes = Monoids.combineScalarFunctors(Maybe::just,Monoids.intSum);
zeroFn
- Function to lift the Identity value into a Scalar Functormonoid
- Monoid to combine the values inside the Scalar Functorsstatic <T,A extends Zippable<T>> Monoid<A> combineZippables(java.util.function.Function<T,A> zeroFn, Monoid<T> monoid)
Monoid<ListX<Integer>> sumLists = Monoids.combineZippables(ListX::of,Monoids.intSum);
zeroFn
- Function to lift the Identity value into a Zippablemonoid
- Monoid to combine the values inside the Zippablesstatic <T> Semigroup<LazyFutureStream<T>> combineFutureStream()
static <T> Monoid<ReactiveSeq<T>> combineReactiveSeq()
static <T> Monoid<org.jooq.lambda.Seq<T>> combineSeq()
static <T> Monoid<java.util.stream.Stream<T>> combineStream()
static <T,C extends java.util.Collection<T>> Monoid<C> firstNonEmpty(C zero)
zero
- Empty Collection of same typestatic <T,C extends java.util.Collection<T>> Monoid<C> lastNonEmpty(C zero)
zero
- Empty Collection of same typestatic <T> Monoid<T> firstNonNull()
static <T> Monoid<java.util.concurrent.CompletableFuture<T>> firstCompleteCompletableFuture()
static <T> Monoid<FutureW<T>> firstCompleteFuture()
static <T> Monoid<FutureW<T>> firstSuccessfulFuture()
static <ST,PT> Monoid<Xor<ST,PT>> firstPrimaryXor(ST zero)
static <ST,PT> Monoid<Xor<ST,PT>> firstSecondaryXor(PT zero)
static <ST,PT> Monoid<Xor<ST,PT>> lastPrimaryXor(ST zero)
static <ST,PT> Monoid<Xor<ST,PT>> lastSecondaryXor(PT zero)
static <T,X extends java.lang.Throwable> Monoid<Try<T,X>> firstTrySuccess(X zero)
static <T,X extends java.lang.Throwable> Monoid<Try<T,X>> firstTryFailure(T zero)
static <T,X extends java.lang.Throwable> Monoid<Try<T,X>> lastTrySuccess(X zero)
static <T,X extends java.lang.Throwable> Monoid<Try<T,X>> lastTryFailure(T zero)
static <ST,PT> Monoid<Ior<ST,PT>> firstPrimaryIor(ST zero)
static <ST,PT> Monoid<Ior<ST,PT>> firstSecondaryIor(PT zero)
static <ST,PT> Monoid<Ior<ST,PT>> lastPrimaryIor(ST zero)
static <ST,PT> Monoid<Ior<ST,PT>> lastSecondaryIor(PT zero)
static <T> Monoid<Maybe<T>> firstPresentMaybe()
static <T> Monoid<java.util.Optional<T>> firstPresentOptional()
static <T> Monoid<Maybe<T>> lastPresentMaybe()
static <T> Monoid<java.util.Optional<T>> lastPresentOptional()
static Monoid<java.lang.String> stringJoin(java.lang.String joiner)
joiner
- Separator in joined Stringstatic Monoid<java.lang.StringBuilder> stringBuilderJoin(java.lang.String joiner)
joiner
- Separator in joined Stringstatic Monoid<java.lang.StringBuffer> stringBufferJoin(java.lang.String joiner)
joiner
- Separator in joined Stringstatic <T,T2 extends java.lang.Comparable<T>> Monoid<T2> minComparable(T2 max)
static <T,T2 extends java.lang.Comparable<T>> Monoid<T2> maxComparable(T2 min)
static <A> Monoid<java.util.function.Function<A,A>> functionComposition()