v2.0.0
This major release brings some breaking changes and some exciting new features. Most breaking changes are caused by the renaming of methods in the API since this new version aims to make the API similar to Java's Optional<T>
. This way, developers will have an easier time remembering the API, plus providing better consistency across their code.
Breaking changes
- Checked functional interfaces methods should have matching names as their non-checked counterparts to allow interoperability with other APIs
- Rename Maybe methods:
- Rename
.resolve(..)
→.fromResolver(..)
- Rename
thenResolve(..)
→.resolve(..)
- Rename
.runEffect(..)
→.fromEffect(..)
- Rename
.thenRunEffect(..)
→.runEffect(..)
- Rename
- Refactor
ResolveHandler
methods:- Rename
.orDefault(..)
→.orElse(..)
- Add
.orElse(..)
overload with mapperFunction<E, T>
- Add
.orElse(..)
overload with supplyingSupplier<T>
- Rename
- Refactor
EffectHandler
methods:- Rename
onErrorThrow(..)
→.orThrow(..)
- Add
.orElse(..)
withConsumer<E>
- Add
.orElse(..)
withRunnable
- Rename
- Refactor error handling of
ResolveHandler
:- Remove
.onError(..)
- Is the same as the new
.orElse(mapper)
plus the new.catchError(..)
overloads
- Is the same as the new
- Add
.catchError(..)
overload matching specific type, withSupplier<T>
- Add
.catchError(..)
overload without spec type, withFunction<E, T>
- Add
.catchError(..)
overload without specific type, withSupplier<T>
- Add
.doOnError(..)
overload matching specific type, withConsumer<E>
- Add
.doOnError(..)
overload matching specific type, withRunnable
- Add
.doOnError(..)
overload without specific type, withRunnable
- Remove
- Refactor error handling of
EffectHandler
:- Fix
.doOnError(..)
to not recover from the error - Add
.doOnError(..)
overload without specific type, withRunnable
- Add
.doOnError(..)
overload matching specific type, withConsumer<X>
- Add
.doOnError(..)
overload matching specific type, withRunnable
- Add
.catchError(..)
overload matching specific type, withRunnable
- Add
.catchError(..)
overload without specific type, withConsumer<E>
- Add
.catchError(..)
overload without specific type, withRunnable
- Fix
New features
- Add
.doOnSuccess(..)
operator to bothResolveHandler
andEffectHandler
- Add partial implementation overloads to
.fromResolver(..)
and.fromEffect(..)
- Add
.resolve(..)
to theResolveHandler
with 2 overloads:- Map and ignore any possible error
- Unwrap-like mapper: Two mappers, one for success another for error
- Add
.fromOptional(..)
static creator