Interface | Description |
---|---|
Either<L,R> |
Either represents a value of two possible types.
|
Option<T> |
Replacement for
Optional . |
Try<T> |
An implementation similar to Scala's Try control.
|
Try.CheckedConsumer<T> |
A Consumer which may throw.
|
Try.CheckedFunction<T,R> |
A Function which may throw.
|
Try.CheckedPredicate<T> |
A Predicate which may throw.
|
Try.CheckedRunnable |
A Runnable which may throw.
|
Try.CheckedSupplier<R> |
A Supplier which may throw.
|
Validation<E,T> |
An implementation similar to scalaz's Validation control.
|
Class | Description |
---|---|
Either.Left<L,R> |
The
Left version of an Either . |
Either.LeftProjection<L,R> |
A left projection of an Either.
|
Either.Right<L,R> |
The
Right version of an Either . |
Either.RightProjection<L,R> |
A right projection of an Either.
|
Option.None<T> |
None is a singleton representation of the undefined
Option . |
Option.Some<T> |
Some represents a defined
Option . |
Try.Failure<T> |
A failed Try.
|
Try.Success<T> |
A succeeded Try.
|
Validation.Builder<E,T1,T2> | |
Validation.Builder3<E,T1,T2,T3> | |
Validation.Builder4<E,T1,T2,T3,T4> | |
Validation.Builder5<E,T1,T2,T3,T4,T5> | |
Validation.Builder6<E,T1,T2,T3,T4,T5,T6> | |
Validation.Builder7<E,T1,T2,T3,T4,T5,T6,T7> | |
Validation.Builder8<E,T1,T2,T3,T4,T5,T6,T7,T8> | |
Validation.Invalid<E,T> |
An invalid Validation
|
Validation.Valid<E,T> |
A valid Validation
|
Exception | Description |
---|---|
Try.FatalException |
An unchecked wrapper for Fatal exceptions.
|
Try.NonFatalException |
An unchecked wrapper for non-fatal/recoverable exceptions.
|
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.
Try internally handles exceptions by wrapping exceptions in a Cause. A Cause is unchecked, i.e. a RuntimeException, and is Fatal or NonFatal. Fatal exceptions cannot be handled and are thrown without further processing. NonFatal exceptions are wrapped in a Failure.
Copyright © 2016. All Rights Reserved.