Package io.atlassian.fugue
Class FugueCollectors
- java.lang.Object
-
- io.atlassian.fugue.FugueCollectors
-
public final class FugueCollectors extends java.lang.ObjectCollectorinstances.- Since:
- 4.8.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFugueCollectors.Ref<A>Mutable reference.
-
Constructor Summary
Constructors Constructor Description FugueCollectors()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A> java.util.stream.Collector<Option<A>,?,java.util.List<A>>flatten()Collect the values wrapped within the option.static <A,B,C>
java.util.stream.Collector<Option<A>,?,C>flatten(java.util.stream.Collector<A,B,C> aCollector)Collect the values wrapped within the option.private static java.util.stream.Collector.Characteristics[]maybeUnorderedCharacteristics(java.util.stream.Collector<?,?,?> delegate)static <L,R>
java.util.stream.Collector<Either<L,R>,?,Either<java.util.List<L>,R>>toEitherLeft()Collect the left values if there are only lefts, otherwise return the first right encountered.static <L,R,A,B>
java.util.stream.Collector<Either<L,R>,?,Either<B,R>>toEitherLeft(java.util.stream.Collector<L,A,B> lCollector)Collect the left values if there are only lefts, otherwise return the first right encountered.static <L,R>
java.util.stream.Collector<Either<L,R>,?,Either<L,java.util.List<R>>>toEitherRight()Collect the right values if there are only rights, otherwise return the first left encountered.static <L,R,A,B>
java.util.stream.Collector<Either<L,R>,?,Either<L,B>>toEitherRight(java.util.stream.Collector<R,A,B> rCollector)Collect the right values if there are only rights, otherwise return the first left encountered.static <A> java.util.stream.Collector<Try<A>,?,Try<java.util.List<A>>>toTrySuccess()Collect the right values if there are only successes, otherwise return the first failure encountered.static <A,B,C>
java.util.stream.Collector<Try<A>,?,Try<C>>toTrySuccess(java.util.stream.Collector<A,B,C> aCollector)Collect the right values if there are only successes, otherwise return the first failure encountered.
-
-
-
Method Detail
-
toEitherLeft
public static <L,R> java.util.stream.Collector<Either<L,R>,?,Either<java.util.List<L>,R>> 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,A,B> java.util.stream.Collector<Either<L,R>,?,Either<B,R>> toEitherLeft(java.util.stream.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
public static <L,R> java.util.stream.Collector<Either<L,R>,?,Either<L,java.util.List<R>>> 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,A,B> java.util.stream.Collector<Either<L,R>,?,Either<L,B>> toEitherRight(java.util.stream.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
public static <A> java.util.stream.Collector<Option<A>,?,java.util.List<A>> flatten()
Collect the values wrapped within the option.- Type Parameters:
A- the option type- Returns:
- flattening collector of
Option. - Since:
- 4.8.0
-
flatten
public static <A,B,C> java.util.stream.Collector<Option<A>,?,C> flatten(java.util.stream.Collector<A,B,C> aCollector)
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
public static <A> java.util.stream.Collector<Try<A>,?,Try<java.util.List<A>>> 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
public static <A,B,C> java.util.stream.Collector<Try<A>,?,Try<C>> toTrySuccess(java.util.stream.Collector<A,B,C> aCollector)
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
private static java.util.stream.Collector.Characteristics[] maybeUnorderedCharacteristics(java.util.stream.Collector<?,?,?> delegate)
-
-