Package io.vavr.control
Either
The control package contains an implementation of the Either control which is either Left or Right. A given Either is projected to a Left or a Right. Both cases can be further processed with control operations map, flatMap, filter. If a Right is projected to a Left, the Left control operations have no effect on the Right value. If a Left is projected to a Right, the Right control operations have no effect on the Left value.
Option
The Option control is a replacement for Optional. An Option is either
Option.Some value or Option.None.
In contrast to Optional, Option supports null values, i.e. it is possible to call new Some(null).
However, Option.of(null) results in None.
Try
Exceptions are handled with the Try control which is either a Try.Success, containing a result, or a Try.Failure, containing an Exception.
-
ClassDescriptionEither<L,
R> Represents a value of one of two possible types:Either.LeftorEither.Right.An exception wrapper used to propagate values through exception handling mechanisms.Either.Left<L,R> TheLeftversion of anEither.Deprecated.Either is right-biased.Either.Right<L,R> TheRightversion of anEither.Deprecated.Either is right-biased.Deprecated.Will be removed from public APIOption<T>A replacement forOptional.Option.None<T>None is a singleton representation of the undefinedOption.Option.Some<T>Some represents a definedOption.Try<T>A control structure that allows writing safe code without explicitly managing try-catch blocks for exceptions.Try.Failure<T>Try.Success<T>Represents a successfulTrycontaining a value.Try.WithResources1<T1 extends AutoCloseable>ATry-with-resources builder that operates on oneAutoCloseableresource.ATry-with-resources builder that operates on twoAutoCloseableresources.ATry-with-resources builder that operates on threeAutoCloseableresources.Try.WithResources4<T1 extends AutoCloseable,T2 extends AutoCloseable, T3 extends AutoCloseable, T4 extends AutoCloseable> ATry-with-resources builder that operates on fourAutoCloseableresources.Try.WithResources5<T1 extends AutoCloseable,T2 extends AutoCloseable, T3 extends AutoCloseable, T4 extends AutoCloseable, T5 extends AutoCloseable> ATry-with-resources builder that operates on fiveAutoCloseableresources.Try.WithResources6<T1 extends AutoCloseable,T2 extends AutoCloseable, T3 extends AutoCloseable, T4 extends AutoCloseable, T5 extends AutoCloseable, T6 extends AutoCloseable> ATry-with-resources builder that operates on sixAutoCloseableresources.Try.WithResources7<T1 extends AutoCloseable,T2 extends AutoCloseable, T3 extends AutoCloseable, T4 extends AutoCloseable, T5 extends AutoCloseable, T6 extends AutoCloseable, T7 extends AutoCloseable> ATry-with-resources builder that operates on sevenAutoCloseableresources.Try.WithResources8<T1 extends AutoCloseable,T2 extends AutoCloseable, T3 extends AutoCloseable, T4 extends AutoCloseable, T5 extends AutoCloseable, T6 extends AutoCloseable, T7 extends AutoCloseable, T8 extends AutoCloseable> ATry-with-resources builder that operates on eightAutoCloseableresources.Validation<E,T> An implementation similar to Scalaz's Validation control.Validation.Builder<E,T1, T2> A builder that holds two Validation instances, used for combining validations and applying functions that take two arguments.Validation.Builder3<E,T1, T2, T3> A builder that holds three Validation instances, used for combining validations and applying functions that take three arguments.Validation.Builder4<E,T1, T2, T3, T4> A builder that holds four Validation instances, used for combining validations and applying functions that take four arguments.Validation.Builder5<E,T1, T2, T3, T4, T5> A builder that holds five Validation instances, used for combining validations and applying functions that take five arguments.Validation.Builder6<E,T1, T2, T3, T4, T5, T6> A builder that holds six Validation instances, used for combining validations and applying functions that take six arguments.Validation.Builder7<E,T1, T2, T3, T4, T5, T6, T7> A builder that holds seven Validation instances, used for combining validations and applying functions that take seven arguments.Validation.Builder8<E,T1, T2, T3, T4, T5, T6, T7, T8> A builder that holds eight Validation instances, used for combining validations and applying functions that take eight arguments.Validation.Invalid<E,T> An invalid ValidationValidation.Valid<E,T> A valid Validation