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 official x
intermediary net/minecraft/class_8144
named net/minecraft/util/Nullables
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getFirst
(Collection<T> collection) Returns the first element ofcollection
, ornull
if it is empty.static <T> T
getFirstOrElse
(Collection<T> collection, T defaultValue) Returns the first element ofcollection
, ordefaultValue
if it is empty.static <T> T
getFirstOrElseGet
(Collection<T> collection, Supplier<T> getter) Returns the first element ofcollection
, orgetter.get()
if it is empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable boolean[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable byte[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable char[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable double[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable float[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable int[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable long[] array) Returns whetherarray
isnull
or empty.static boolean
isEmpty
(@org.jetbrains.annotations.Nullable short[] array) Returns whetherarray
isnull
or empty.static <T> boolean
isEmpty
(@Nullable T[] array) Returns whetherarray
isnull
or empty.static <T,
R> R Returns thevalue
withmapper
applied if the value is notnull
, otherwisenull
.static <T,
R> R Returns thevalue
withmapper
applied if the value is notnull
, otherwiseother
.static <T,
R> R mapOrElseGet
(T value, Function<T, R> mapper, Supplier<R> getter) Returns thevalue
withmapper
applied if the value is notnull
, otherwisegetter.get()
.
-
Constructor Details
-
Nullables
public Nullables()
-
-
Method Details
-
map
Returns thevalue
withmapper
applied if the value is notnull
, otherwisenull
.This is the nullable equivalent to
Optional.map(java.util.function.Function<? super T, ? extends U>)
.- Returns:
- the
value
withmapper
applied if the value is notnull
, otherwisenull
- Mappings:
Namespace Name Mixin selector official a
Lx;a(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
intermediary method_49077
Lnet/minecraft/class_8144;method_49077(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
named map
Lnet/minecraft/util/Nullables;map(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
-
mapOrElse
Returns thevalue
withmapper
applied 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
value
withmapper
applied if the value is notnull
, otherwiseother
- Mappings:
Namespace Name Mixin selector official a
Lx;a(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;
intermediary method_49078
Lnet/minecraft/class_8144;method_49078(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;
named mapOrElse
Lnet/minecraft/util/Nullables;mapOrElse(Ljava/lang/Object;Ljava/util/function/Function;Ljava/lang/Object;)Ljava/lang/Object;
-
mapOrElseGet
Returns thevalue
withmapper
applied 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
value
withmapper
applied if the value is notnull
, otherwisegetter.get()
- Mappings:
Namespace Name Mixin selector official a
Lx;a(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;
intermediary method_49079
Lnet/minecraft/class_8144;method_49079(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;
named mapOrElseGet
Lnet/minecraft/util/Nullables;mapOrElseGet(Ljava/lang/Object;Ljava/util/function/Function;Ljava/util/function/Supplier;)Ljava/lang/Object;
-
getFirst
Returns the first element ofcollection
, ornull
if it is empty.- Returns:
- the first element of
collection
, ornull
if it is empty - Mappings:
Namespace Name Mixin selector official a
Lx;a(Ljava/util/Collection;)Ljava/lang/Object;
intermediary method_49080
Lnet/minecraft/class_8144;method_49080(Ljava/util/Collection;)Ljava/lang/Object;
named getFirst
Lnet/minecraft/util/Nullables;getFirst(Ljava/util/Collection;)Ljava/lang/Object;
-
getFirstOrElse
Returns the first element ofcollection
, ordefaultValue
if it is empty.- Returns:
- the first element of
collection
, ordefaultValue
if it is empty - Mappings:
Namespace Name Mixin selector official a
Lx;a(Ljava/util/Collection;Ljava/lang/Object;)Ljava/lang/Object;
intermediary method_49081
Lnet/minecraft/class_8144;method_49081(Ljava/util/Collection;Ljava/lang/Object;)Ljava/lang/Object;
named getFirstOrElse
Lnet/minecraft/util/Nullables;getFirstOrElse(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 official a
Lx;a(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;
intermediary method_49082
Lnet/minecraft/class_8144;method_49082(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;
named getFirstOrElseGet
Lnet/minecraft/util/Nullables;getFirstOrElseGet(Ljava/util/Collection;Ljava/util/function/Supplier;)Ljava/lang/Object;
-
isEmpty
public static <T> boolean isEmpty(@Nullable @Nullable T[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([Ljava/lang/Object;)Z
intermediary method_49089
Lnet/minecraft/class_8144;method_49089([Ljava/lang/Object;)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([Ljava/lang/Object;)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable boolean[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([Z)Z
intermediary method_49091
Lnet/minecraft/class_8144;method_49091([Z)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([Z)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable byte[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([B)Z
intermediary method_49083
Lnet/minecraft/class_8144;method_49083([B)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([B)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable char[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([C)Z
intermediary method_49084
Lnet/minecraft/class_8144;method_49084([C)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([C)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable short[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([S)Z
intermediary method_49090
Lnet/minecraft/class_8144;method_49090([S)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([S)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable int[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([I)Z
intermediary method_49087
Lnet/minecraft/class_8144;method_49087([I)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([I)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable long[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([J)Z
intermediary method_49088
Lnet/minecraft/class_8144;method_49088([J)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([J)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable float[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([F)Z
intermediary method_49086
Lnet/minecraft/class_8144;method_49086([F)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([F)Z
-
isEmpty
public static boolean isEmpty(@Nullable @org.jetbrains.annotations.Nullable double[] array) Returns whetherarray
isnull
or empty.- Returns:
- whether
array
isnull
or empty - Mappings:
Namespace Name Mixin selector official a
Lx;a([D)Z
intermediary method_49085
Lnet/minecraft/class_8144;method_49085([D)Z
named isEmpty
Lnet/minecraft/util/Nullables;isEmpty([D)Z
-