Package net.minecraft.util
Class Nullables
java.lang.Object
net.minecraft.util.Nullables
Contains utility methods that accept or return nullable values.
- Mappings:
Namespace Name named net/minecraft/util/Nullablesintermediary net/minecraft/class_8144official t
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @Nullable TgetFirst(Collection<T> collection) Returns the first element ofcollection, ornullif it is empty.static <T> TgetFirstOrElse(Collection<T> collection, T defaultValue) Returns the first element ofcollection, ordefaultValueif it is empty.static <T> TgetFirstOrElseGet(Collection<T> collection, Supplier<T> getter) Returns the first element ofcollection, orgetter.get()if it is empty.static booleanisEmpty(boolean @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(byte @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(char @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(double @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(float @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(int @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(long @Nullable [] array) Returns whetherarrayisnullor empty.static booleanisEmpty(short @Nullable [] array) Returns whetherarrayisnullor empty.static <T> booleanisEmpty(T @Nullable [] array) Returns whetherarrayisnullor empty.static <T,R> @Nullable R Returns thevaluewithmapperapplied if the value is notnull, otherwisenull.static <T,R> R Returns thevaluewithmapperapplied if the value is notnull, otherwiseother.static <T,R> R mapOrElseGet(@Nullable T value, Function<T, R> mapper, Supplier<R> getter) Returns thevaluewithmapperapplied if the value is notnull, otherwisegetter.get().static <T> TrequireNonNullElse(@Nullable T first, T second) Deprecated.
-
Constructor Details
-
Nullables
public Nullables()
-
-
Method Details
-
requireNonNullElse
Deprecated.- Mappings:
Namespace Name Mixin selector named requireNonNullElseLnet/minecraft/util/Nullables;requireNonNullElse(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_62789Lnet/minecraft/class_8144;method_62789(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;official aLt;a(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
-
map
Returns thevaluewithmapperapplied if the value is notnull, otherwisenull.This is the nullable equivalent to
Optional.map(java.util.function.Function<? super T, ? extends U>).- Returns:
- the
valuewithmapperapplied if the value is notnull, otherwisenull - Mappings:
Namespace Name Mixin selector named mapLnet/minecraft/util/Nullables;map(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;intermediary method_49077Lnet/minecraft/class_8144;method_49077(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;official aLt;a(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
-
mapOrElse
Returns thevaluewithmapperapplied if the value is notnull, otherwiseother.This is the nullable equivalent to
Optional.map(java.util.function.Function<? super T, ? extends U>)chained withOptional.orElse(T).- Returns:
- the
valuewithmapperapplied if the value is notnull, otherwiseother - Mappings:
Namespace Name Mixin selector named mapOrElseLnet/minecraft/util/Nullables;mapOrElse(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_49078Lnet/minecraft/class_8144;method_49078(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;official aLt;a(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;
-
mapOrElseGet
Returns thevaluewithmapperapplied if the value is notnull, otherwisegetter.get().This is the nullable equivalent to
Optional.map(java.util.function.Function<? super T, ? extends U>)chained withOptional.orElseGet(java.util.function.Supplier<? extends T>).- Returns:
- the
valuewithmapperapplied if the value is notnull, otherwisegetter.get() - Mappings:
Namespace Name Mixin selector named mapOrElseGetLnet/minecraft/util/Nullables;mapOrElseGet(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;intermediary method_49079Lnet/minecraft/class_8144;method_49079(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;official aLt;a(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;
-
getFirst
Returns the first element ofcollection, ornullif it is empty.- Returns:
- the first element of
collection, ornullif it is empty - Mappings:
Namespace Name Mixin selector named getFirstLnet/minecraft/util/Nullables;getFirst(Ljava/util/Collection;)Ljava/lang/Object;intermediary method_49080Lnet/minecraft/class_8144;method_49080(Ljava/util/Collection;)Ljava/lang/Object;official aLt;a(Ljava/util/Collection;)Ljava/lang/Object;
-
getFirstOrElse
Returns the first element ofcollection, ordefaultValueif it is empty.- Returns:
- the first element of
collection, ordefaultValueif it is empty - Mappings:
Namespace Name Mixin selector named getFirstOrElseLnet/minecraft/util/Nullables;getFirstOrElse(Ljava/util/Collection;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_49081Lnet/minecraft/class_8144;method_49081(Ljava/util/Collection;Ljava/lang/Object;)Ljava/lang/Object;official aLt;a(Ljava/util/Collection;Ljava/lang/Object;)Ljava/lang/Object;
-
getFirstOrElseGet
Returns the first element ofcollection, orgetter.get()if it is empty.- Returns:
- the first element of
collection, orgetter.get()if it is empty - Mappings:
Namespace Name Mixin selector named getFirstOrElseGetLnet/minecraft/util/Nullables;getFirstOrElseGet(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;intermediary method_49082Lnet/minecraft/class_8144;method_49082(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;official aLt;a(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;
-
isEmpty
public static <T> boolean isEmpty(T @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([Ljava/lang/Object;)Zintermediary method_49089Lnet/minecraft/class_8144;method_49089([Ljava/lang/Object;)Zofficial aLt;a([Ljava/lang/Object;)Z
-
isEmpty
public static boolean isEmpty(boolean @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([Z)Zintermediary method_49091Lnet/minecraft/class_8144;method_49091([Z)Zofficial aLt;a([Z)Z
-
isEmpty
public static boolean isEmpty(byte @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([B)Zintermediary method_49083Lnet/minecraft/class_8144;method_49083([B)Zofficial aLt;a([B)Z
-
isEmpty
public static boolean isEmpty(char @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([C)Zintermediary method_49084Lnet/minecraft/class_8144;method_49084([C)Zofficial aLt;a([C)Z
-
isEmpty
public static boolean isEmpty(short @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([S)Zintermediary method_49090Lnet/minecraft/class_8144;method_49090([S)Zofficial aLt;a([S)Z
-
isEmpty
public static boolean isEmpty(int @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([I)Zintermediary method_49087Lnet/minecraft/class_8144;method_49087([I)Zofficial aLt;a([I)Z
-
isEmpty
public static boolean isEmpty(long @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([J)Zintermediary method_49088Lnet/minecraft/class_8144;method_49088([J)Zofficial aLt;a([J)Z
-
isEmpty
public static boolean isEmpty(float @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([F)Zintermediary method_49086Lnet/minecraft/class_8144;method_49086([F)Zofficial aLt;a([F)Z
-
isEmpty
public static boolean isEmpty(double @Nullable [] array) Returns whetherarrayisnullor empty.- Returns:
- whether
arrayisnullor empty - Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/util/Nullables;isEmpty([D)Zintermediary method_49085Lnet/minecraft/class_8144;method_49085([D)Zofficial aLt;a([D)Z
-