Skip to content

Commit 8c95805

Browse files
author
Mark Perry
committed
Added Option.toValidation
1 parent 4b525f3 commit 8c95805

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/java/fj/data/Option.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ public final <X> Either<X, A> toEither(final X x) {
479479
return isSome() ? Either.<X, A>right(some()) : Either.<X, A>left(x);
480480
}
481481

482+
public final <X> Validation<X, A> toValidation(final X x) {
483+
return Validation.validation(toEither(x));
484+
}
485+
482486
/**
483487
* A first-class version of the toEither method.
484488
*

0 commit comments

Comments
 (0)