Package com.petrolpark.util
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.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final recordNeither.NeitherStreamCodec<B extends io.netty.buffer.ByteBuf,L, R> static final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptioneither()static <L,R> Neither <L, R> either(com.mojang.datafixers.util.Either<L, R> either) static <L,R> Neither <L, R> 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) flatMapLeft(Function<L, Neither<L2, R>> function) default booleanisEmpty()booleanisLeft()booleanbooleanisRight()left()static <L,R> Neither <L, R> left(L value) <T> Optional<T> <C,D> Neither <C, D> static <L,R> Neither <L, R> neither()right()static <L,R> Neither <L, R> right(R value) 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) swap()
-
Method Details
-
isPresent
boolean isPresent() -
isLeft
boolean isLeft() -
isRight
boolean isRight() -
isEmpty
default boolean isEmpty() -
mapBoth
-
map
-
ifLeft
-
ifRight
-
ifNeither
-
left
-
right
-
either
-
mapLeft
-
mapRight
-
fieldCodec
-
streamCodec
static <B extends io.netty.buffer.ByteBuf,L, net.minecraft.network.codec.StreamCodec<B,R> Neither<L, streamCodecR>> (net.minecraft.network.codec.StreamCodec<? super B, L> leftCodec, net.minecraft.network.codec.StreamCodec<? super B, R> rightCodec) -
either
-
either
-
left
-
right
-
neither
-
swap
-
flatMapLeft
-