Interface Neither<L,R>

All Known Implementing Classes:
Neither.Left, Neither.None, Neither.Right

public sealed interface Neither<L,R> permits Neither.Left<L,R>, Neither.Right<L,R>, Neither.None<L,R>
Extension to Either that permits neither value, in addition to just the left or just the right.
  • Method Details

    • isPresent

      boolean isPresent()
    • isLeft

      boolean isLeft()
    • isRight

      boolean isRight()
    • isEmpty

      default boolean isEmpty()
    • mapBoth

      <C, D> Neither<C,D> mapBoth(Function<? super L,? extends C> f1, Function<? super R,? extends D> f2)
    • map

      <T> Optional<T> map(Function<? super L,? extends T> l, Function<? super R,? extends T> r)
    • ifLeft

      Neither<L,R> ifLeft(Consumer<? super L> consumer)
    • ifRight

      Neither<L,R> ifRight(Consumer<? super R> consumer)
    • ifNeither

      Neither<L,R> ifNeither(Runnable runnable)
    • left

      Optional<L> left()
    • right

      Optional<R> right()
    • either

      Optional<com.mojang.datafixers.util.Either<L,R>> either()
    • mapLeft

      default <T> Neither<T,R> mapLeft(Function<? super L,? extends T> l)
    • mapRight

      default <T> Neither<L,T> mapRight(Function<? super R,? extends T> l)
    • fieldCodec

      static <L, R> com.mojang.serialization.MapCodec<Neither<L,R>> fieldCodec(com.mojang.serialization.Codec<L> leftCodec, com.mojang.serialization.Codec<R> rightCodec, String key)
    • streamCodec

      static <B extends io.netty.buffer.ByteBuf, L, R> net.minecraft.network.codec.StreamCodec<B,Neither<L,R>> streamCodec(net.minecraft.network.codec.StreamCodec<? super B,L> leftCodec, net.minecraft.network.codec.StreamCodec<? super B,R> rightCodec)
    • either

      static <L, R> Neither<L,R> either(Optional<com.mojang.datafixers.util.Either<L,R>> either)
    • either

      static <L, R> Neither<L,R> either(com.mojang.datafixers.util.Either<L,R> either)
    • left

      static <L, R> Neither<L,R> left(L value)
    • right

      static <L, R> Neither<L,R> right(R value)
    • neither

      static <L, R> Neither<L,R> neither()
    • swap

      default Neither<R,L> swap()
    • flatMapLeft

      default <L2> Neither<L2,R> flatMapLeft(Function<L,Neither<L2,R>> function)