orNull
Creates an instance of Zero from the specified number, or returns null
if the number is other than zero.
Calling from Kotlin
Here's an example of calling this method from Kotlin code:
val number: Byte = 0
val zero: Zero? = Zero.orNull(number)
assertNotNull(zero)
Content copied to clipboard
This method is not available from Java code due to its non-explicit support for nullable types.
See the orThrow method for throwing an exception instead of returning null
in case of invalid number.