Class Either<V,E>

java.lang.Object
ch.tocco.nice2.toolbox.api.functional.Either<V,E>

public class Either<V,E> extends Object
  • Method Details

    • onCondition

      public static <V, E> Either<V,E> onCondition(boolean condition, V value, E error)
    • onValue

      public static <V, E> Either<V,E> onValue(V value)
    • onError

      public static <V, E> Either<V,E> onError(E error)
    • hasError

      public boolean hasError()
    • getValue

      public Optional<V> getValue()
    • getError

      public Optional<E> getError()
    • map

      public <R> R map(Function<V,R> valueHandler, Function<E,R> errorHandler)