diff --git a/pom.xml b/pom.xml
index 1279036..906cf3c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
2.12
1.2.0
net.kemitix.mon
- 4.1.1
+ 5.0.0
diff --git a/src/main/java/net/kemitix/mon/Functor.java b/src/main/java/net/kemitix/mon/Functor.java
index 7dc4fa1..acd8a06 100644
--- a/src/main/java/net/kemitix/mon/Functor.java
+++ b/src/main/java/net/kemitix/mon/Functor.java
@@ -48,5 +48,5 @@ public interface Functor> {
*
* @return a Functor containing the result of the function {@code f} applied to the value
*/
- F map(Function f);
+ public abstract F map(Function f);
}
diff --git a/src/main/java/net/kemitix/mon/combinator/After.java b/src/main/java/net/kemitix/mon/combinator/After.java
index 3fd00c4..783a98f 100644
--- a/src/main/java/net/kemitix/mon/combinator/After.java
+++ b/src/main/java/net/kemitix/mon/combinator/After.java
@@ -52,7 +52,7 @@ public interface After extends
* @return a partially applied Function that will take an argument and return the result of applying it to the
* function parameter
*/
- static Function decorate(
+ public static Function decorate(
final Function function,
final BiConsumer after
) {
@@ -68,7 +68,7 @@ public interface After extends
*
* @return a curried function that will pass the argument and the result of the function to the supplied bi-consumer
*/
- static After create() {
+ public static After create() {
return function -> after -> argument -> {
final R result = function.apply(argument);
after.accept(argument, result);
diff --git a/src/main/java/net/kemitix/mon/combinator/Around.java b/src/main/java/net/kemitix/mon/combinator/Around.java
index b6d8e2e..8adcae1 100644
--- a/src/main/java/net/kemitix/mon/combinator/Around.java
+++ b/src/main/java/net/kemitix/mon/combinator/Around.java
@@ -54,7 +54,7 @@ public interface Around extends
*
* @return a partially applied Function that will take an argument, and the result of applying it to function
*/
- static Function decorate(
+ public static Function decorate(
final Function function,
final BiConsumer, T> around
) {
@@ -71,7 +71,7 @@ public interface Around extends
* @return a curried function that will execute the around function, passing an executable and the invocations
* argument. The around function must {@code execute()} the executable and may capture the result.
*/
- static Around create() {
+ public static Around create() {
return function -> around -> argument -> {
final AtomicReference result = new AtomicReference<>();
final Executable callback = () -> {
@@ -89,13 +89,13 @@ public interface Around extends
* @param the return type of the function
*/
@FunctionalInterface
- interface Executable {
+ public static interface Executable {
/**
* Executes the function.
*
* @return the result of applying the function
*/
- R execute();
+ public abstract R execute();
}
}
diff --git a/src/main/java/net/kemitix/mon/combinator/Before.java b/src/main/java/net/kemitix/mon/combinator/Before.java
index 4e40a29..5bbe5bd 100644
--- a/src/main/java/net/kemitix/mon/combinator/Before.java
+++ b/src/main/java/net/kemitix/mon/combinator/Before.java
@@ -53,7 +53,7 @@ public interface Before extends
* @return a partially applied Function that will take an argument and return the result of applying it to the
* function parameter
*/
- static Function decorate(
+ public static Function decorate(
final Consumer before,
final Function function
) {
@@ -69,7 +69,7 @@ public interface Before extends
*
* @return a curried function that will pass the argument to before applying the supplied function
*/
- static Before create() {
+ public static Before create() {
return before -> function -> argument -> {
before.accept(argument);
return function.apply(argument);
diff --git a/src/main/java/net/kemitix/mon/experimental/either/Either.java b/src/main/java/net/kemitix/mon/experimental/either/Either.java
index 90aa272..78de86e 100644
--- a/src/main/java/net/kemitix/mon/experimental/either/Either.java
+++ b/src/main/java/net/kemitix/mon/experimental/either/Either.java
@@ -41,7 +41,7 @@ public interface Either {
* @param the type of the right value
* @return a Either holding the left value
*/
- static Either left(final L l) {
+ public static Either left(final L l) {
return new Left<>(l);
}
@@ -53,7 +53,7 @@ public interface Either {
* @param the type of the right value
* @return a Either holding the right value
*/
- static Either right(final R r) {
+ public static Either right(final R r) {
return new Right<>(r);
}
@@ -62,14 +62,14 @@ public interface Either {
*
* @return true if this Either is a left
*/
- boolean isLeft();
+ public abstract boolean isLeft();
/**
* Checks if the Either holds a right value.
*
* @return true if this Either is a right
*/
- boolean isRight();
+ public abstract boolean isRight();
/**
* Matches the Either, invoking the correct Consumer.
@@ -77,7 +77,7 @@ public interface Either {
* @param onLeft the Consumer to invoke when the Either is a left
* @param onRight the Consumer to invoke when the Either is a right
*/
- void match(Consumer onLeft, Consumer onRight);
+ public abstract void match(Consumer onLeft, Consumer onRight);
/**
* Map the function across the left value.
@@ -86,7 +86,7 @@ public interface Either {
* @param the type to change the left value to
* @return a new Either
*/
- Either mapLeft(Function f);
+ public abstract Either mapLeft(Function f);
/**
* Map the function across the right value.
@@ -95,5 +95,5 @@ public interface Either {
* @param the type to change the right value to
* @return a new Either
*/
- Either mapRight(Function f);
+ public abstract Either mapRight(Function f);
}
diff --git a/src/main/java/net/kemitix/mon/maybe/Maybe.java b/src/main/java/net/kemitix/mon/maybe/Maybe.java
index c862a32..43fd8cd 100644
--- a/src/main/java/net/kemitix/mon/maybe/Maybe.java
+++ b/src/main/java/net/kemitix/mon/maybe/Maybe.java
@@ -50,7 +50,7 @@ public interface Maybe extends Functor> {
* @param the type of the value
* @return a Maybe of the value
*/
- static Maybe just(@NonNull final T value) {
+ public static Maybe just(@NonNull final T value) {
return new Just<>(value);
}
@@ -61,7 +61,7 @@ public interface Maybe extends Functor> {
* @return an empty Maybe
*/
@SuppressWarnings("unchecked")
- static Maybe nothing() {
+ public static Maybe nothing() {
return (Maybe) Nothing.INSTANCE;
}
@@ -74,7 +74,7 @@ public interface Maybe extends Functor> {
* @param the type of the value
* @return a Maybe, either a Just, or Nothing if value is null
*/
- static Maybe maybe(final T value) {
+ public static Maybe maybe(final T value) {
if (value == null) {
return nothing();
}
@@ -86,14 +86,14 @@ public interface Maybe extends Functor> {
*
* @return true if the Maybe is a Just
*/
- boolean isJust();
+ public abstract boolean isJust();
/**
* Checks if the Maybe is Nothing.
*
* @return true if the Maybe is Nothing
*/
- boolean isNothing();
+ public abstract boolean isNothing();
/**
* Monad binder maps the Maybe into another Maybe using the binder method f.
@@ -102,10 +102,10 @@ public interface Maybe extends Functor> {
* @param the type of the value in the final maybe
* @return a Maybe with the mapped value
*/
- Maybe flatMap(Function> f);
+ public abstract Maybe flatMap(Function> f);
@Override
- Maybe map(Function f);
+ public abstract Maybe map(Function f);
/**
* Provide a value to use when Maybe is Nothing.
@@ -113,7 +113,7 @@ public interface Maybe extends Functor> {
* @param supplier supplier for an alternate value
* @return a Maybe
*/
- T orElseGet(Supplier supplier);
+ public abstract T orElseGet(Supplier supplier);
/**
* A value to use when Maybe is Nothing.
@@ -121,14 +121,14 @@ public interface Maybe extends Functor> {
* @param otherValue an alternate value
* @return the value of the Maybe if a Just, otherwise the otherValue
*/
- T orElse(T otherValue);
+ public abstract T orElse(T otherValue);
/**
* Convert the Maybe to an {@link Optional}.
*
* @return an Optional containing a value for a Just, or empty for a Nothing
*/
- Optional toOptional();
+ public abstract Optional toOptional();
/**
* Throw the exception if the Maybe is a Nothing.
@@ -138,14 +138,14 @@ public interface Maybe extends Functor> {
* @return the value of the Maybe if a Just
* @throws X if the Maybe is nothing
*/
- T orElseThrow(Supplier extends X> e) throws X;
+ public abstract T orElseThrow(Supplier extends X> e) throws X;
/**
* Converts the Maybe into either a single value stream or an empty stream.
*
* @return a Stream containing the value or nothing.
*/
- Stream stream();
+ public abstract Stream stream();
/**
* Filter a Maybe by the predicate, replacing with Nothing when it fails.
@@ -153,7 +153,7 @@ public interface Maybe extends Functor> {
* @param predicate the test
* @return the Maybe, or Nothing if the test returns false
*/
- Maybe filter(Predicate predicate);
+ public abstract Maybe filter(Predicate predicate);
/**
* Provide the value within the Maybe, if it exists, to the Consumer, and returns this Maybe.
@@ -161,14 +161,14 @@ public interface Maybe extends Functor> {
* @param consumer the Consumer to the value if present
* @return this Maybe
*/
- Maybe peek(Consumer consumer);
+ public abstract Maybe peek(Consumer consumer);
/**
* Run the runnable if the Maybe is a Nothing, otherwise do nothing.
*
* @param runnable the runnable to call if this is a Nothing
*/
- void ifNothing(Runnable runnable);
+ public abstract void ifNothing(Runnable runnable);
/**
* Matches the Maybe, either just or nothing, and performs either the Consumer, for Just, or Runnable for nothing.
@@ -176,7 +176,7 @@ public interface Maybe extends Functor> {
* @param justMatcher the Consumer to pass the value of a Just to
* @param nothingMatcher the Runnable to call if the Maybe is a Nothing
*/
- void match(Consumer justMatcher, Runnable nothingMatcher);
+ public abstract void match(Consumer justMatcher, Runnable nothingMatcher);
/**
* Maps the Maybe into another Maybe only when it is nothing.
@@ -185,5 +185,5 @@ public interface Maybe extends Functor> {
*
* @return the original Maybe if not nothing, or the alternative
*/
- Maybe or(Supplier> alternative);
+ public abstract Maybe or(Supplier> alternative);
}
diff --git a/src/main/java/net/kemitix/mon/result/Result.java b/src/main/java/net/kemitix/mon/result/Result.java
index c84a1ba..cef55c9 100644
--- a/src/main/java/net/kemitix/mon/result/Result.java
+++ b/src/main/java/net/kemitix/mon/result/Result.java
@@ -44,7 +44,7 @@ public interface Result extends Functor> {
* @param the type of the Maybe and the Result
* @return a Result containing the value of the Maybe when it is a Just, or the error when it is Nothing
*/
- static Result fromMaybe(final Maybe maybe, final Supplier error) {
+ public static Result fromMaybe(final Maybe maybe, final Supplier error) {
return maybe.map(Result::ok)
.orElseGet(() -> Result.error(error.get()));
}
@@ -56,7 +56,7 @@ public interface Result extends Functor> {
* @param the type had the result been a success
* @return an error Result
*/
- static Result error(final Throwable error) {
+ public static Result error(final Throwable error) {
return new Err<>(error);
}
@@ -68,7 +68,7 @@ public interface Result extends Functor> {
* @return a Result
*/
@SuppressWarnings("illegalcatch")
- static Result of(final Callable callable) {
+ public static Result of(final Callable callable) {
try {
return Result.ok(callable.call());
} catch (final Exception e) {
@@ -83,7 +83,7 @@ public interface Result extends Functor> {
* @param the type of the value
* @return a successful Result
*/
- static Result ok(final T value) {
+ public static Result ok(final T value) {
return new Success<>(value);
}
@@ -97,7 +97,7 @@ public interface Result extends Functor> {
* @return a Result containing the value of the Maybe when it is a Just, or the error when it is Nothing
*/
@SuppressWarnings("illegalcatch")
- static Maybe toMaybe(final Result result) {
+ public static Maybe toMaybe(final Result result) {
try {
return Maybe.just(result.orElseThrow());
} catch (final Throwable throwable) {
@@ -112,7 +112,7 @@ public interface Result extends Functor> {
* @throws Throwable the result is an error
*/
@SuppressWarnings("illegalthrows")
- T orElseThrow() throws Throwable;
+ public abstract T orElseThrow() throws Throwable;
/**
* Swaps the inner Result of a Maybe, so that a Result is on the outside.
@@ -123,7 +123,7 @@ public interface Result extends Functor> {
* original Maybe. If the original Maybe is Nothing, the Result will contain Nothing. If the original Result was an
* error, then the Result will also be an error.
*/
- static Result> swap(final Maybe> maybeResult) {
+ public static Result> swap(final Maybe> maybeResult) {
return maybeResult.orElseGet(() -> Result.ok(null))
.flatMap(value -> Result.ok(Maybe.maybe(value)));
}
@@ -135,7 +135,7 @@ public interface Result extends Functor> {
* @param the type of the value withing the Result of the mapping function
* @return a Result
*/
- Result flatMap(Function> f);
+ public abstract Result flatMap(Function> f);
/**
* Applies the function to the contents of a Maybe within the Result.
@@ -146,7 +146,7 @@ public interface Result extends Functor> {
* @param the type of the updated Result
* @return a new Maybe within a Result
*/
- static Result> flatMapMaybe(
+ public static Result> flatMapMaybe(
final Result> maybeResult,
final Function, Result>> f
) {
@@ -158,17 +158,17 @@ public interface Result extends Functor> {
*
* @return true if the Result is an error.
*/
- boolean isError();
+ public abstract boolean isError();
/**
* Checks if the Result is a success.
*
* @return true if the Result is a success.
*/
- boolean isOkay();
+ public abstract boolean isOkay();
@Override
- Result map(Function f);
+ public abstract Result map(Function f);
/**
* Matches the Result, either success or error, and supplies the appropriate Consumer with the value or error.
@@ -176,7 +176,7 @@ public interface Result extends Functor> {
* @param onSuccess the Consumer to pass the value of a successful Result to
* @param onError the Consumer to pass the error from an error Result to
*/
- void match(Consumer onSuccess, Consumer onError);
+ public abstract void match(Consumer onSuccess, Consumer onError);
/**
* Wraps the value within the Result in a Maybe, either a Just if the predicate is true, or Nothing.
@@ -184,7 +184,7 @@ public interface Result extends Functor> {
* @param predicate the test to decide
* @return a Result containing a Maybe that may or may not contain a value
*/
- Result> maybe(Predicate predicate);
+ public abstract Result> maybe(Predicate predicate);
/**
* Provide the value within the Result, if it is a success, to the Consumer, and returns this Result.
@@ -192,7 +192,7 @@ public interface Result extends Functor> {
* @param consumer the Consumer to the value if a success
* @return this Result
*/
- Result peek(Consumer consumer);
+ public abstract Result peek(Consumer consumer);
/**
* Provide a way to attempt to recover from an error state.
@@ -200,7 +200,7 @@ public interface Result extends Functor> {
* @param f the function to recover from the error
* @return a new Result, either a Success, or if recovery is not possible an other Err.
*/
- Result