Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public record Result<T>(boolean isSuccess, T value) {
- private Result {
- // Private constructor
- }
- // Static method to create a Result instance representing success
- public static <T> Result<T> success(T value) {
- return new Result<>(true, value);
- }
- // Static method to create a Result instance representing failure
- public static <T> Result<T> failure() {
- return new Result<>(false, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement