Class Either<L,​R>

  • Direct Known Subclasses:
    FEELFnResult

    public class Either<L,​R>
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Either​(java.util.Optional<L> left, java.util.Optional<R> right)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <X> X cata​(java.util.function.Function<L,​X> left, java.util.function.Function<R,​X> right)  
      void consume​(java.util.function.Consumer<L> leftConsumer, java.util.function.Consumer<R> rightConsumer)  
      protected java.util.Optional<L> getLeft()  
      R getOrElse​(R default_value)  
      <E extends java.lang.Exception>
      R
      getOrElseThrow​(java.util.function.Function<L,​E> exceptionFn)  
      protected java.util.Optional<R> getRight()  
      boolean isLeft()  
      boolean isRight()  
      static <L,​R>
      Either<L,​R>
      ofLeft​(L value)  
      static <L,​R>
      Either<L,​R>
      ofRight​(R value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Either

        protected Either​(java.util.Optional<L> left,
                         java.util.Optional<R> right)
    • Method Detail

      • ofLeft

        public static <L,​R> Either<L,​R> ofLeft​(L value)
      • ofRight

        public static <L,​R> Either<L,​R> ofRight​(R value)
      • isLeft

        public boolean isLeft()
      • isRight

        public boolean isRight()
      • getLeft

        protected java.util.Optional<L> getLeft()
      • getRight

        protected java.util.Optional<R> getRight()
      • getOrElse

        public R getOrElse​(R default_value)
      • getOrElseThrow

        public <E extends java.lang.Exception> R getOrElseThrow​(java.util.function.Function<L,​E> exceptionFn)
                                                         throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • cata

        public <X> X cata​(java.util.function.Function<L,​X> left,
                          java.util.function.Function<R,​X> right)
      • consume

        public void consume​(java.util.function.Consumer<L> leftConsumer,
                            java.util.function.Consumer<R> rightConsumer)