Skip to content

Commit

Permalink
BL-967
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Jan 22, 2025
1 parent 0af152a commit 2bfc54b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/ortus/boxlang/runtime/dynamic/Attempt.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package ortus.boxlang.runtime.dynamic;

import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
Expand Down Expand Up @@ -786,4 +787,11 @@ public Attempt<T> setSimpleEval( Boolean eval ) {
return this;
}

/**
* Convert this attempt to a standard Java Optional
*/
public Optional<T> toOptional() {
return Optional.ofNullable( this.value );
}

}

0 comments on commit 2bfc54b

Please sign in to comment.