Class Left<L,​R>

  • All Implemented Interfaces:
    Either<L,​R>
    Direct Known Subclasses:
    Failure

    class Left<L,​R>
    extends java.lang.Object
    implements Either<L,​R>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private L value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Left​(L value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<L> asLeft()  
      java.util.Optional<R> asRight()  
      boolean equals​(java.lang.Object other)  
      void exec​(java.util.function.Consumer<? super L> ifLeft, java.util.function.Consumer<? super R> ifRight)  
      <L2,​R2>
      Either<L2,​R2>
      flatMap​(java.util.function.Function<? super L,​Either<L2,​R2>> f, java.util.function.Function<? super R,​Either<L2,​R2>> g)  
      <L2> Either<L2,​R> flatMapLeft​(java.util.function.Function<? super L,​Either<L2,​R>> f)  
      <R2> Either<L,​R2> flatMapRight​(java.util.function.Function<? super R,​Either<L,​R2>> f)  
      L getLeft()  
      R getRight()  
      int hashCode()  
      void ifLeft​(java.util.function.Consumer<? super L> f)  
      void ifRight​(java.util.function.Consumer<? super R> f)  
      boolean isLeft()  
      boolean isRight()  
      <L2,​R2>
      Either<L2,​R2>
      map​(java.util.function.Function<? super L,​? extends L2> f, java.util.function.Function<? super R,​? extends R2> g)  
      <L2> Either<L2,​R> mapLeft​(java.util.function.Function<? super L,​? extends L2> f)  
      <R2> Either<L,​R2> mapRight​(java.util.function.Function<? super R,​? extends R2> f)  
      L toLeft​(java.util.function.Function<? super R,​? extends L> f)  
      R toRight​(java.util.function.Function<? super L,​? extends R> f)  
      java.lang.String toString()  
      <T> T unify​(java.util.function.Function<? super L,​? extends T> f, java.util.function.Function<? super R,​? extends T> g)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        private final L value
    • Constructor Detail

      • Left

        public Left​(L value)
    • Method Detail

      • isLeft

        public boolean isLeft()
        Specified by:
        isLeft in interface Either<L,​R>
      • isRight

        public boolean isRight()
        Specified by:
        isRight in interface Either<L,​R>
      • getLeft

        public L getLeft()
        Specified by:
        getLeft in interface Either<L,​R>
      • getRight

        public R getRight()
        Specified by:
        getRight in interface Either<L,​R>
      • toLeft

        public L toLeft​(java.util.function.Function<? super R,​? extends L> f)
        Specified by:
        toLeft in interface Either<L,​R>
      • toRight

        public R toRight​(java.util.function.Function<? super L,​? extends R> f)
        Specified by:
        toRight in interface Either<L,​R>
      • asLeft

        public java.util.Optional<L> asLeft()
        Specified by:
        asLeft in interface Either<L,​R>
      • asRight

        public java.util.Optional<R> asRight()
        Specified by:
        asRight in interface Either<L,​R>
      • ifLeft

        public void ifLeft​(java.util.function.Consumer<? super L> f)
        Specified by:
        ifLeft in interface Either<L,​R>
      • ifRight

        public void ifRight​(java.util.function.Consumer<? super R> f)
        Specified by:
        ifRight in interface Either<L,​R>
      • exec

        public void exec​(java.util.function.Consumer<? super L> ifLeft,
                         java.util.function.Consumer<? super R> ifRight)
        Specified by:
        exec in interface Either<L,​R>
      • mapLeft

        public <L2> Either<L2,​R> mapLeft​(java.util.function.Function<? super L,​? extends L2> f)
        Specified by:
        mapLeft in interface Either<L,​R>
      • mapRight

        public <R2> Either<L,​R2> mapRight​(java.util.function.Function<? super R,​? extends R2> f)
        Specified by:
        mapRight in interface Either<L,​R>
      • map

        public <L2,​R2> Either<L2,​R2> map​(java.util.function.Function<? super L,​? extends L2> f,
                                                     java.util.function.Function<? super R,​? extends R2> g)
        Specified by:
        map in interface Either<L,​R>
      • flatMap

        public <L2,​R2> Either<L2,​R2> flatMap​(java.util.function.Function<? super L,​Either<L2,​R2>> f,
                                                         java.util.function.Function<? super R,​Either<L2,​R2>> g)
        Specified by:
        flatMap in interface Either<L,​R>
      • flatMapLeft

        public <L2> Either<L2,​R> flatMapLeft​(java.util.function.Function<? super L,​Either<L2,​R>> f)
        Specified by:
        flatMapLeft in interface Either<L,​R>
      • flatMapRight

        public <R2> Either<L,​R2> flatMapRight​(java.util.function.Function<? super R,​Either<L,​R2>> f)
        Specified by:
        flatMapRight in interface Either<L,​R>
      • unify

        public <T> T unify​(java.util.function.Function<? super L,​? extends T> f,
                           java.util.function.Function<? super R,​? extends T> g)
        Specified by:
        unify in interface Either<L,​R>
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object