All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.infilos.spring.utils.Eithers Maven / Gradle / Ivy

package com.infilos.spring.utils;

import io.vavr.control.Either;

import java.util.Optional;

public final class Eithers {
    private Eithers() {
    }

    public static  Either anyVoid() {
        return Either.right(null);
    }

    /**
     * Dirty use optional as parameter to avoid verbose result construction.
     */
    public static  Either orElse(Optional right, L left) {
        return right.>map(Either::right).orElseGet(() -> Either.left(left));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy