Objects.RequireNonNullElse(Object, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the first argument if it is non-null
and
otherwise returns the non-null
second argument.
[Android.Runtime.Register("requireNonNullElse", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "", ApiSince=30)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object RequireNonNullElse (Java.Lang.Object? obj, Java.Lang.Object defaultObj);
[<Android.Runtime.Register("requireNonNullElse", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "", ApiSince=30)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member RequireNonNullElse : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object
Parameters
- obj
- Object
an object
- defaultObj
- Object
a non-null
object to return if the first argument
is null
Returns
the first argument if it is non-null
and
otherwise the second argument if it is non-null
- Attributes
Remarks
Returns the first argument if it is non-null
and otherwise returns the non-null
second argument.
Added in 9.
Java documentation for java.util.Objects.requireNonNullElse(T, T)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.