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

io.github.cwdesautels.monad.Right Maven / Gradle / Ivy

package io.github.cwdesautels.monad;

import io.github.cwdesautels.annotation.Nullable;
import org.immutables.value.Value;

import java.util.NoSuchElementException;

@Value.Immutable
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
public interface Right extends Either {
    @Override
    @Nullable
    R get();

    @Override
    @Value.Auxiliary
    default L getLeft() {
        throw new NoSuchElementException();
    }

    @Override
    default boolean isLeft() {
        return false;
    }

    @Override
    default boolean isRight() {
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy