diff --git a/build.gradle b/build.gradle
index 9e3c762..7777595 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,5 +12,5 @@ repositories {
}
dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.12'
+ testImplementation group: 'junit', name: 'junit', version: '4.12'
}
diff --git a/jmonad.iml b/jmonad.iml
new file mode 100644
index 0000000..fed139b
--- /dev/null
+++ b/jmonad.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jmonad.main.iml b/jmonad.main.iml
new file mode 100644
index 0000000..411da5a
--- /dev/null
+++ b/jmonad.main.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jmonad.test.iml b/jmonad.test.iml
new file mode 100644
index 0000000..42e5226
--- /dev/null
+++ b/jmonad.test.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/bvn13/jmonad/Failure.java b/src/main/java/com/bvn13/jmonad/Failure.java
index 0d9b610..5f68138 100644
--- a/src/main/java/com/bvn13/jmonad/Failure.java
+++ b/src/main/java/com/bvn13/jmonad/Failure.java
@@ -49,6 +49,11 @@ public class Failure extends Try {
throw e;
}
+ @Override
+ public T orElseThrow() throws Throwable {
+ throw e;
+ }
+
@Override
public Optional toOptional() {
return Optional.empty();
diff --git a/src/main/java/com/bvn13/jmonad/Success.java b/src/main/java/com/bvn13/jmonad/Success.java
index cbd5ccf..0fa0d8f 100644
--- a/src/main/java/com/bvn13/jmonad/Success.java
+++ b/src/main/java/com/bvn13/jmonad/Success.java
@@ -51,7 +51,11 @@ public class Success extends Try {
@Override
public T orElseThrow(Throwable e) throws Throwable {
- Objects.requireNonNull(e);
+ return value;
+ }
+
+ @Override
+ public T orElseThrow() throws Throwable {
return value;
}
diff --git a/src/main/java/com/bvn13/jmonad/Try.java b/src/main/java/com/bvn13/jmonad/Try.java
index da8be0d..829939d 100644
--- a/src/main/java/com/bvn13/jmonad/Try.java
+++ b/src/main/java/com/bvn13/jmonad/Try.java
@@ -42,6 +42,8 @@ public abstract class Try {
public abstract T orElseThrow(Throwable e) throws Throwable;
+ public abstract T orElseThrow() throws Throwable;
+
public abstract Optional toOptional();
public abstract boolean isSuccess();