Package com.atlassian.jira.util
Class EitherUtils
java.lang.Object
com.atlassian.jira.util.EitherUtils
Utility functions for Eithers.
- Since:
- v6.4
-
Method Summary
Modifier and TypeMethodDescriptionsplitEithers(Iterable<io.atlassian.fugue.Either<L, R>> eithers) Transforms list of Eithers into two lists, which contains left and right values.static <L extends RuntimeException,R>
RunwrapEither(io.atlassian.fugue.Either<L, R> either) Gets the right value from anEitheror throws its left value.
-
Method Details
-
splitEithers
public static <L,R> io.atlassian.fugue.Pair<List<L>,List<R>> splitEithers(Iterable<io.atlassian.fugue.Either<L, R>> eithers) Transforms list of Eithers into two lists, which contains left and right values. -
unwrapEither
Gets the right value from anEitheror throws its left value. Requires the left type to be aRuntimeExceptionso that it can be used directly with higher-order functions likeOptional.map(java.util.function.Function<? super T, ? extends U>)without needing to handle checked exceptions explicitly.- Type Parameters:
L- the left type of the eitherR- the right type of the either- Parameters:
either- theEitherto unwrap- Returns:
- the unwrapped right value
- Throws:
L- if the either has a left value
-