Package io.atlassian.fugue
Class FugueCollectors
java.lang.Object
io.atlassian.fugue.FugueCollectors
Collector instances.- Since:
- 4.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classMutable reference. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionflatten()Collect the values wrapped within the option.Collect the values wrapped within the option.private static Collector.Characteristics[]maybeUnorderedCharacteristics(Collector<?, ?, ?> delegate) Collect the left values if there are only lefts, otherwise return the first right encountered.toEitherLeft(Collector<L, A, B> lCollector) Collect the left values if there are only lefts, otherwise return the first right encountered.Collect the right values if there are only rights, otherwise return the first left encountered.toEitherRight(Collector<R, A, B> rCollector) Collect the right values if there are only rights, otherwise return the first left encountered.Collect the right values if there are only successes, otherwise return the first failure encountered.toTrySuccess(Collector<A, B, C> aCollector) Collect the right values if there are only successes, otherwise return the first failure encountered.
-
Constructor Details
-
FugueCollectors
public FugueCollectors()
-
-
Method Details
-
toEitherLeft
Collect the left values if there are only lefts, otherwise return the first right encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostEither.Rightvalue is returned.- Type Parameters:
L- the LHS typeR- the RHS type- Returns:
- left biased collector of
Either. - Since:
- 4.8.0
-
toEitherLeft
public static <L,R, Collector<Either<L,A, B> R>, toEitherLeft?, Either<B, R>> (Collector<L, A, B> lCollector) Collect the left values if there are only lefts, otherwise return the first right encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostEither.Rightvalue is returned.- Type Parameters:
L- the LHS typeR- the RHS typeA- the mutable accumulation type of the reduction operationB- the result type of the reduction operation- Parameters:
lCollector- result collector- Returns:
- left biased collector of
Either. - Since:
- 4.8.0
-
toEitherRight
Collect the right values if there are only rights, otherwise return the first left encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostEither.Leftvalue is returned.- Type Parameters:
L- the LHS typeR- the RHS type- Returns:
- right biased collector of
Either. - Since:
- 4.8.0
-
toEitherRight
public static <L,R, Collector<Either<L,A, B> R>, toEitherRight?, Either<L, B>> (Collector<R, A, B> rCollector) Collect the right values if there are only rights, otherwise return the first left encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostEither.Leftvalue is returned.- Type Parameters:
L- the LHS typeR- the RHS typeA- the mutable accumulation type of the reduction operationB- the result type of the reduction operation- Parameters:
rCollector- result collector- Returns:
- right biased collector of
Either. - Since:
- 4.8.0
-
flatten
Collect the values wrapped within the option.- Type Parameters:
A- the option type- Returns:
- flattening collector of
Option. - Since:
- 4.8.0
-
flatten
Collect the values wrapped within the option.- Type Parameters:
A- the option typeB- the mutable accumulation type of the reduction operationC- the result type of the reduction operation- Parameters:
aCollector- result collector- Returns:
- flattening collector of
Option. - Since:
- 4.8.0
-
toTrySuccess
Collect the right values if there are only successes, otherwise return the first failure encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostio.atlassian.fugue.Try.Failurevalue is returned.- Type Parameters:
A- the success type- Returns:
- success biased collector of
Try. - Since:
- 4.8.0
-
toTrySuccess
Collect the right values if there are only successes, otherwise return the first failure encountered. Collectors have `foldLeft` semantics. ForSpliterator.ORDEREDsequences the left-mostio.atlassian.fugue.Try.Failurevalue is returned.- Type Parameters:
A- the success typeB- the mutable accumulation type of the reduction operationC- the result type of the reduction operation- Returns:
- success biased collector of
Try. - Since:
- 4.8.0
-
maybeUnorderedCharacteristics
-